Class IndicesTemplate
java.lang.Object
org.springframework.data.elasticsearch.client.elc.ChildTemplate<co.elastic.clients.transport.ElasticsearchTransport,co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient>
org.springframework.data.elasticsearch.client.elc.IndicesTemplate
- All Implemented Interfaces:
IndexOperations
public class IndicesTemplate
extends ChildTemplate<co.elastic.clients.transport.ElasticsearchTransport,co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient>
implements IndexOperations
Implementation of the
IndexOperations interface using en ElasticsearchIndicesClient.- Since:
- 4.4
- Author:
- Peter-Josef Meisch
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.data.elasticsearch.client.elc.ChildTemplate
ChildTemplate.ClientCallback<CLIENT,RESULT> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Class<?>protected final IndexCoordinatesprotected final ElasticsearchConverterFields inherited from class org.springframework.data.elasticsearch.client.elc.ChildTemplate
client, exceptionTranslator, requestConverter, responseConverter -
Constructor Summary
ConstructorsConstructorDescriptionIndicesTemplate(co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient client, ClusterTemplate clusterTemplate, ElasticsearchConverter elasticsearchConverter, Class<?> boundClass) IndicesTemplate(co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient client, ClusterTemplate clusterTemplate, ElasticsearchConverter elasticsearchConverter, IndexCoordinates boundIndex) -
Method Summary
Modifier and TypeMethodDescriptionbooleanalias(AliasActions aliasActions) Executes the givenAliasActions.protected Class<?>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 templatebooleandeleteIndexTemplate(DeleteIndexTemplateRequest deleteIndexTemplateRequest) Deletes an index template.booleandeleteTemplate(DeleteTemplateRequest deleteTemplateRequest) Deletes an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).protected booleanbooleanexists()Checks if the index this IndexOperations is bound to existsbooleanexistsComponentTemplate(ExistsComponentTemplateRequest existsComponentTemplateRequest) Checks wether a component index template exists.booleanexistsIndexTemplate(ExistsIndexTemplateRequest existsIndexTemplateRequest) check if an index template exists.booleanexistsTemplate(ExistsTemplateRequest existsTemplateRequest) check if an index template exists using the legacy Elasticsearch interface.getAliases(String... aliasNames) gets information about aliasesgetAliasesFor(Class<?> clazz) Get theAliasof the provided class.getAliasesForIndex(String... indexNames) gets information about aliasesgetComponentTemplate(GetComponentTemplateRequest getComponentTemplateRequest) Get a component template.get the currentIndexCoordinates.getIndexCoordinatesFor(Class<?> clazz) getIndexTemplate(GetIndexTemplateRequest getIndexTemplateRequest) Gets an index template.getInformation(IndexCoordinates indexCoordinates) 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.getTemplate(GetTemplateRequest getTemplateRequest) gets an index template using the legacy Elasticsearch interface.booleanputComponentTemplate(PutComponentTemplateRequest putComponentTemplateRequest) Writes a component index template that can be used in a composable index template.booleanputIndexTemplate(PutIndexTemplateRequest putIndexTemplateRequest) Creates an index templatebooleanputMapping(Document mapping) writes a mapping to the indexbooleanputTemplate(PutTemplateRequest putTemplateRequest) Creates an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).voidrefresh()Refresh the index(es) this IndexOperations is bound toMethods inherited from class org.springframework.data.elasticsearch.client.elc.ChildTemplate
executeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.elasticsearch.core.IndexOperations
deleteIndexTemplate, deleteTemplate, existsIndexTemplate, existsTemplate, getIndexTemplate, getInformation, getTemplate, putMapping, putMapping
-
Field Details
-
elasticsearchConverter
-
boundClass
-
boundIndex
-
-
Constructor Details
-
IndicesTemplate
public IndicesTemplate(co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient client, ClusterTemplate clusterTemplate, ElasticsearchConverter elasticsearchConverter, Class<?> boundClass) -
IndicesTemplate
public IndicesTemplate(co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient client, ClusterTemplate clusterTemplate, ElasticsearchConverter elasticsearchConverter, IndexCoordinates boundIndex)
-
-
Method Details
-
checkForBoundClass
-
create
public boolean create()Description copied from interface:IndexOperationsCreate an index.- Specified by:
createin interfaceIndexOperations- Returns:
- true if the index was created
-
create
Description copied from interface:IndexOperationsCreate an index for given settings.- Specified by:
createin interfaceIndexOperations- Parameters:
settings- the index settings- Returns:
- true if the index was created
-
create
Description copied from interface:IndexOperationsCreate an index for given settings and mapping.- Specified by:
createin interfaceIndexOperations- Parameters:
settings- the index settingsmapping- the index mapping- Returns:
- true if the index was created
-
createWithMapping
public boolean createWithMapping()Description copied from interface:IndexOperationsCreate an index with the settings and mapping defined for the entity this IndexOperations is bound to.- Specified by:
createWithMappingin interfaceIndexOperations- Returns:
- true if the index was created
-
doCreate
-
delete
public boolean delete()Description copied from interface:IndexOperationsDeletes the index thisIndexOperationsis bound to- Specified by:
deletein interfaceIndexOperations- Returns:
- true if the index was deleted
-
exists
public boolean exists()Description copied from interface:IndexOperationsChecks if the index this IndexOperations is bound to exists- Specified by:
existsin interfaceIndexOperations- Returns:
- true if the index exists
-
refresh
public void refresh()Description copied from interface:IndexOperationsRefresh the index(es) this IndexOperations is bound to- Specified by:
refreshin interfaceIndexOperations
-
createMapping
Description copied from interface:IndexOperationsCreates the index mapping for the entity this IndexOperations is bound to.- Specified by:
createMappingin interfaceIndexOperations- Returns:
- mapping object
-
createMapping
Description copied from interface:IndexOperationsCreates the index mapping for the given class- Specified by:
createMappingin interfaceIndexOperations- Parameters:
clazz- the clazz to create a mapping for- Returns:
- mapping object
-
putMapping
Description copied from interface:IndexOperationswrites a mapping to the index- Specified by:
putMappingin interfaceIndexOperations- Parameters:
mapping- the Document with the mapping definitions- Returns:
- true if the mapping could be stored
-
getMapping
Description copied from interface:IndexOperationsGet mapping for an index defined by a class.- Specified by:
getMappingin interfaceIndexOperations- Returns:
- the mapping
-
createSettings
Description copied from interface:IndexOperationsCreates the index settings for the entity this IndexOperations is bound to.- Specified by:
createSettingsin interfaceIndexOperations- Returns:
- a settings document.
-
createSettings
Description copied from interface:IndexOperationsCreates the index settings from the annotations on the given class- Specified by:
createSettingsin interfaceIndexOperations- Parameters:
clazz- the class to create the index settings from- Returns:
- a settings document.
-
getSettings
Description copied from interface:IndexOperationsGet the index settings.- Specified by:
getSettingsin interfaceIndexOperations- Returns:
- the settings
-
getSettings
Description copied from interface:IndexOperationsGet the index settings.- Specified by:
getSettingsin interfaceIndexOperations- Parameters:
includeDefaults- whether or not to include all the default settings- Returns:
- the settings
-
alias
Description copied from interface:IndexOperationsExecutes the givenAliasActions.- Specified by:
aliasin interfaceIndexOperations- Parameters:
aliasActions- the actions to execute- Returns:
- if the operation is acknowledged by Elasticsearch
-
getAliases
Description copied from interface:IndexOperationsgets information about aliases- Specified by:
getAliasesin interfaceIndexOperations- Parameters:
aliasNames- alias names, must not be null- Returns:
- a
Mapfrom index names toAliasDatafor that index
-
getAliasesForIndex
Description copied from interface:IndexOperationsgets information about aliases- Specified by:
getAliasesForIndexin interfaceIndexOperations- Parameters:
indexNames- index names, must not be null- Returns:
- a
Mapfrom index names toAliasDatafor that index
-
putTemplate
Description copied from interface:IndexOperationsCreates an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).- Specified by:
putTemplatein interfaceIndexOperations- Parameters:
putTemplateRequest- template request parameters- Returns:
- true if successful
-
getTemplate
Description copied from interface:IndexOperationsgets an index template using the legacy Elasticsearch interface.- Specified by:
getTemplatein interfaceIndexOperations- Parameters:
getTemplateRequest- the request parameters- Returns:
- TemplateData, null if no template with the given name exists.
-
existsTemplate
Description copied from interface:IndexOperationscheck if an index template exists using the legacy Elasticsearch interface.- Specified by:
existsTemplatein interfaceIndexOperations- Parameters:
existsTemplateRequest- the request parameters- Returns:
- true if the index exists
-
deleteTemplate
Description copied from interface:IndexOperationsDeletes an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).- Specified by:
deleteTemplatein interfaceIndexOperations- Parameters:
deleteTemplateRequest- template request parameters- Returns:
- true if successful
-
putIndexTemplate
Description copied from interface:IndexOperationsCreates an index template- Specified by:
putIndexTemplatein interfaceIndexOperations- Parameters:
putIndexTemplateRequest- template request parameters- Returns:
- true if successful
-
existsIndexTemplate
Description copied from interface:IndexOperationscheck if an index template exists.- Specified by:
existsIndexTemplatein interfaceIndexOperations- Parameters:
existsIndexTemplateRequest- the request parameters- Returns:
- true if the index template exists
-
getIndexTemplate
Description copied from interface:IndexOperationsGets an index template.- Specified by:
getIndexTemplatein interfaceIndexOperations- Parameters:
getIndexTemplateRequest- the request parameters
-
deleteIndexTemplate
Description copied from interface:IndexOperationsDeletes an index template.- Specified by:
deleteIndexTemplatein interfaceIndexOperations- Parameters:
deleteIndexTemplateRequest- template request parameters- Returns:
- true if successful
-
putComponentTemplate
Description copied from interface:IndexOperationsWrites a component index template that can be used in a composable index template.- Specified by:
putComponentTemplatein interfaceIndexOperations- Parameters:
putComponentTemplateRequest- index template request parameters- Returns:
- true if successful
-
existsComponentTemplate
public boolean existsComponentTemplate(ExistsComponentTemplateRequest existsComponentTemplateRequest) Description copied from interface:IndexOperationsChecks wether a component index template exists.- Specified by:
existsComponentTemplatein interfaceIndexOperations- Parameters:
existsComponentTemplateRequest- the parameters for the request- Returns:
- true if the componentTemplate exists.
-
getComponentTemplate
public List<TemplateResponse> getComponentTemplate(GetComponentTemplateRequest getComponentTemplateRequest) Description copied from interface:IndexOperationsGet a component template.- Specified by:
getComponentTemplatein interfaceIndexOperations- Parameters:
getComponentTemplateRequest- parameters for the request, may contain wildcard names- Returns:
- the found
TemplateResponses, may be empty
-
deleteComponentTemplate
public boolean deleteComponentTemplate(DeleteComponentTemplateRequest deleteComponentTemplateRequest) Description copied from interface:IndexOperationsDeletes the given component index template- Specified by:
deleteComponentTemplatein interfaceIndexOperations- Parameters:
deleteComponentTemplateRequest- request parameters- Returns:
- true if successful.
-
getInformation
Description copied from interface:IndexOperationsGets theIndexInformationfor the indices defined by #index.- Specified by:
getInformationin interfaceIndexOperations- Parameters:
indexCoordinates- defines the index names to get the information for- Returns:
- a list of
IndexInformation
-
getIndexCoordinates
Description copied from interface:IndexOperationsget 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.- Specified by:
getIndexCoordinatesin interfaceIndexOperations- Returns:
- IndexCoordinates
-
getIndexCoordinatesFor
-
getAliasesFor
Get theAliasof the provided class.- Parameters:
clazz- provided class that can be used to extract aliases.
-