Module spring.data.elasticsearch
Interface IndexOperations
- All Known Subinterfaces:
IndexOperationsAdapter
- All Known Implementing Classes:
IndicesTemplate
public interface IndexOperations
The operations for the
Elasticsearch Index APIs.
IndexOperations are bound to an entity class or an IndexCoordinate by
IndexOperations are bound to an entity class or an IndexCoordinate by
ElasticsearchOperations.indexOps(IndexCoordinates) or ElasticsearchOperations.indexOps(Class)- Since:
- 4.0
- Author:
- Peter-Josef Meisch, Sascha Woo, George Popides
-
Method Summary
Modifier and TypeMethodDescriptionbooleanalias(AliasActions aliasActions) Executes the givenAliasActions.booleancreate()Create an index.booleanCreate an index for given settings.booleanCreate an index for given settings and mapping.Creates the index mapping for the entity this IndexOperations is bound to.createMapping(Class<?> clazz) Creates the index mapping for the given classCreates the index settings for the entity this IndexOperations is bound to.createSettings(Class<?> clazz) Creates the index settings from the annotations on the given classbooleanCreate an index with the settings and mapping defined for the entity this IndexOperations is bound to.booleandelete()Deletes the index thisIndexOperationsis bound tobooleandeleteComponentTemplate(DeleteComponentTemplateRequest deleteComponentTemplateRequest) Deletes the given component index templatedefault booleandeleteIndexTemplate(String templateName) Deletes an index template.booleandeleteIndexTemplate(DeleteIndexTemplateRequest deleteIndexTemplateRequest) Deletes an index template.default booleandeleteTemplate(String templateName) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.booleandeleteTemplate(DeleteTemplateRequest deleteTemplateRequest) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.booleanexists()Checks if the index this IndexOperations is bound to existsbooleanexistsComponentTemplate(ExistsComponentTemplateRequest existsComponentTemplateRequest) Checks wether a component index template exists.default booleanexistsIndexTemplate(String templateName) check if an index template exists.booleanexistsIndexTemplate(ExistsIndexTemplateRequest existsTemplateRequest) check if an index template exists.default booleanexistsTemplate(String templateName) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.booleanexistsTemplate(ExistsTemplateRequest existsTemplateRequest) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.getAliases(String... aliasNames) gets information about aliasesgetAliasesForIndex(String... indexNames) gets information about aliasesgetComponentTemplate(GetComponentTemplateRequest getComponentTemplateRequest) Get a component template.get the currentIndexCoordinates.default List<TemplateResponse>getIndexTemplate(String templateName) Gets an index template.getIndexTemplate(GetIndexTemplateRequest getIndexTemplateRequest) Gets an index template.default List<IndexInformation>Gets theIndexInformationfor the indices defined bygetIndexCoordinates().getInformation(IndexCoordinates index) Gets theIndexInformationfor the indices defined by #index.Get mapping for an index defined by a class.Get the index settings.getSettings(boolean includeDefaults) Get the index settings.default TemplateDatagetTemplate(String templateName) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.getTemplate(GetTemplateRequest getTemplateRequest) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.booleanputComponentTemplate(PutComponentTemplateRequest putComponentTemplateRequest) Writes a component index template that can be used in a composable index template.booleanputIndexTemplate(PutIndexTemplateRequest putIndexTemplateRequest) Creates an index templatedefault booleanWrites the mapping to the index for the class this IndexOperations is bound to.default booleanputMapping(Class<?> clazz) Creates the index mapping for the given class and writes it to the index.booleanputMapping(Document mapping) writes a mapping to the indexbooleanputTemplate(PutTemplateRequest putTemplateRequest) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.voidrefresh()Refresh the index(es) this IndexOperations is bound to
-
Method Details
-
create
boolean create()Create an index.- Returns:
- true if the index was created
-
create
Create an index for given settings.- Parameters:
settings- the index settings- Returns:
- true if the index was created
-
create
Create an index for given settings and mapping.- Parameters:
settings- the index settingsmapping- the index mapping- Returns:
- true if the index was created
- Since:
- 4.2
-
createWithMapping
boolean createWithMapping()Create an index with the settings and mapping defined for the entity this IndexOperations is bound to.- Returns:
- true if the index was created
- Since:
- 4.2
-
delete
boolean delete()Deletes the index thisIndexOperationsis bound to- Returns:
- true if the index was deleted
-
exists
boolean exists()Checks if the index this IndexOperations is bound to exists- Returns:
- true if the index exists
-
refresh
void refresh()Refresh the index(es) this IndexOperations is bound to -
createMapping
Document createMapping()Creates the index mapping for the entity this IndexOperations is bound to.- Returns:
- mapping object
-
createMapping
Creates the index mapping for the given class- Parameters:
clazz- the clazz to create a mapping for- Returns:
- mapping object
-
putMapping
default boolean putMapping()Writes the mapping to the index for the class this IndexOperations is bound to.- Returns:
- true if the mapping could be stored
- Since:
- 4.1
-
putMapping
writes a mapping to the index- Parameters:
mapping- the Document with the mapping definitions- Returns:
- true if the mapping could be stored
-
putMapping
Creates the index mapping for the given class and writes it to the index.- Parameters:
clazz- the clazz to create a mapping for- Returns:
- true if the mapping could be stored
- Since:
- 4.1
-
getMapping
Get mapping for an index defined by a class.- Returns:
- the mapping
-
createSettings
Settings createSettings()Creates the index settings for the entity this IndexOperations is bound to.- Returns:
- a settings document.
- Since:
- 4.1
-
createSettings
Creates the index settings from the annotations on the given class- Parameters:
clazz- the class to create the index settings from- Returns:
- a settings document.
- Since:
- 4.1
-
getSettings
Settings getSettings()Get the index settings.- Returns:
- the settings
-
getSettings
Get the index settings.- Parameters:
includeDefaults- whether or not to include all the default settings- Returns:
- the settings
-
alias
Executes the givenAliasActions.- Parameters:
aliasActions- the actions to execute- Returns:
- if the operation is acknowledged by Elasticsearch
- Since:
- 4.1
-
getAliases
gets information about aliases -
getAliasesForIndex
gets information about aliases -
putTemplate
Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.Creates an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).- Parameters:
putTemplateRequest- template request parameters- Returns:
- true if successful
- Since:
- 4.1
-
putIndexTemplate
Creates an index template- Parameters:
putIndexTemplateRequest- template request parameters- Returns:
- true if successful
- Since:
- 5.1
-
putComponentTemplate
Writes a component index template that can be used in a composable index template.- Parameters:
putComponentTemplateRequest- index template request parameters- Returns:
- true if successful
- Since:
- 5.1
-
existsComponentTemplate
Checks wether a component index template exists.- Parameters:
existsComponentTemplateRequest- the parameters for the request- Returns:
- true if the componentTemplate exists.
- Since:
- 5.1
-
getComponentTemplate
List<TemplateResponse> getComponentTemplate(GetComponentTemplateRequest getComponentTemplateRequest) Get a component template.- Parameters:
getComponentTemplateRequest- parameters for the request, may contain wildcard names- Returns:
- the found
TemplateResponses, may be empty - Since:
- 5.1
-
deleteComponentTemplate
Deletes the given component index template- Parameters:
deleteComponentTemplateRequest- request parameters- Returns:
- true if successful.
- Since:
- 5.1
-
getTemplate
Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.gets an index template using the legacy Elasticsearch interface.- Parameters:
templateName- the template name- Returns:
- TemplateData, null if no template with the given name exists.
- Since:
- 4.1
-
getTemplate
Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.gets an index template using the legacy Elasticsearch interface.- Parameters:
getTemplateRequest- the request parameters- Returns:
- TemplateData, null if no template with the given name exists.
- Since:
- 4.1
-
existsTemplate
Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.check if an index template exists using the legacy Elasticsearch interface.- Parameters:
templateName- the template name- Returns:
- true if the index exists
- Since:
- 4.1
-
existsTemplate
Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.check if an index template exists using the legacy Elasticsearch interface.- Parameters:
existsTemplateRequest- the request parameters- Returns:
- true if the index exists
- Since:
- 4.1
-
existsIndexTemplate
check if an index template exists.- Parameters:
templateName- the template name- Returns:
- true if the index template exists
- Since:
- 5.1
-
existsIndexTemplate
check if an index template exists.- Parameters:
existsTemplateRequest- the request parameters- Returns:
- true if the index template exists
- Since:
- 5.1
-
getIndexTemplate
Gets an index template.- Parameters:
templateName- template name- Since:
- 5.1
-
getIndexTemplate
Gets an index template.- Parameters:
getIndexTemplateRequest- the request parameters- Since:
- 5.1
-
deleteIndexTemplate
Deletes an index template.- Parameters:
templateName- template name- Returns:
- true if successful
- Since:
- 5.1
-
deleteIndexTemplate
Deletes an index template.- Parameters:
deleteIndexTemplateRequest- template request parameters- Returns:
- true if successful
- Since:
- 5.1
-
deleteTemplate
Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.Deletes an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).- Parameters:
templateName- the template name- Returns:
- true if successful
- Since:
- 4.1
-
deleteTemplate
Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.Deletes an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).- Parameters:
deleteTemplateRequest- template request parameters- Returns:
- true if successful
- Since:
- 4.1
-
getInformation
Gets theIndexInformationfor the indices defined bygetIndexCoordinates().- Returns:
- a list of
IndexInformation - Since:
- 4.2
-
getInformation
Gets theIndexInformationfor the indices defined by #index.- Parameters:
index- defines the index names to get the information for- Returns:
- a list of
IndexInformation - Since:
- 4.2
-
getIndexCoordinates
IndexCoordinates getIndexCoordinates()get the currentIndexCoordinates. These may change over time when the entity class has a SpEL constructed index name. When this IndexOperations is not bound to a class, the bound IndexCoordinates are returned.- Returns:
- IndexCoordinates
- Since:
- 4.1
-