Interface IndexOperations
- All Known Implementing Classes:
AbstractIndexTemplate
,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 TypeMethodDescriptionboolean
alias
(AliasActions aliasActions) Executes the givenAliasActions
.boolean
create()
Create an index.boolean
Create an index for given settings.boolean
Create 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 classboolean
Create an index with the settings and mapping defined for the entity this IndexOperations is bound to.boolean
delete()
Deletes the index thisIndexOperations
is bound toboolean
deleteComponentTemplate
(DeleteComponentTemplateRequest deleteComponentTemplateRequest) Deletes the given component index templatedefault boolean
deleteIndexTemplate
(String templateName) Deletes an index template.boolean
deleteIndexTemplate
(DeleteIndexTemplateRequest deleteIndexTemplateRequest) Deletes an index template.default boolean
deleteTemplate
(String templateName) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.boolean
deleteTemplate
(DeleteTemplateRequest deleteTemplateRequest) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.boolean
exists()
Checks if the index this IndexOperations is bound to existsboolean
existsComponentTemplate
(ExistsComponentTemplateRequest existsComponentTemplateRequest) Checks wether a component index template exists.default boolean
existsIndexTemplate
(String templateName) check if an index template exists.boolean
existsIndexTemplate
(ExistsIndexTemplateRequest existsTemplateRequest) check if an index template exists.default boolean
existsTemplate
(String templateName) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.boolean
existsTemplate
(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 theIndexInformation
for the indices defined bygetIndexCoordinates()
.getInformation
(IndexCoordinates index) Gets theIndexInformation
for 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 TemplateData
getTemplate
(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.boolean
putComponentTemplate
(PutComponentTemplateRequest putComponentTemplateRequest) Writes a component index template that can be used in a composable index template.boolean
putIndexTemplate
(PutIndexTemplateRequest putIndexTemplateRequest) Creates an index templatedefault boolean
Writes the mapping to the index for the class this IndexOperations is bound to.default boolean
putMapping
(Class<?> clazz) Creates the index mapping for the given class and writes it to the index.boolean
putMapping
(Document mapping) writes a mapping to the indexboolean
putTemplate
(PutTemplateRequest putTemplateRequest) Deprecated.since 5.1, as the underlying Elasticsearch API is deprecated.void
refresh()
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 thisIndexOperations
is 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
TemplateResponse
s, 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 theIndexInformation
for the indices defined bygetIndexCoordinates()
.- Returns:
- a list of
IndexInformation
- Since:
- 4.2
-
getInformation
Gets theIndexInformation
for 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
-