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
Modifier and TypeFieldDescriptionprotected final Class<?>
protected final IndexCoordinates
protected final ElasticsearchConverter
Fields inherited from class org.springframework.data.elasticsearch.client.elc.ChildTemplate
client, exceptionTranslator, requestConverter, responseConverter
-
Constructor Summary
ConstructorDescriptionIndicesTemplate
(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 TypeMethodDescriptionboolean
alias
(AliasActions aliasActions) Executes the givenAliasActions
.protected Class<?>
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 templateboolean
deleteIndexTemplate
(DeleteIndexTemplateRequest deleteIndexTemplateRequest) Deletes an index template.boolean
deleteTemplate
(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 boolean
boolean
exists()
Checks if the index this IndexOperations is bound to existsboolean
existsComponentTemplate
(ExistsComponentTemplateRequest existsComponentTemplateRequest) Checks wether a component index template exists.boolean
existsIndexTemplate
(ExistsIndexTemplateRequest existsIndexTemplateRequest) check if an index template exists.boolean
existsTemplate
(ExistsTemplateRequest existsTemplateRequest) check if an index template exists using the legacy Elasticsearch interface.getAliases
(String... aliasNames) gets information about aliasesgetAliasesForIndex
(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 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.getTemplate
(GetTemplateRequest getTemplateRequest) gets an index template using the legacy Elasticsearch interface.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 templateboolean
putMapping
(Document mapping) writes a mapping to the indexboolean
putTemplate
(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).void
refresh()
Refresh the index(es) this IndexOperations is bound toMethods inherited from class org.springframework.data.elasticsearch.client.elc.ChildTemplate
execute
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:IndexOperations
Create an index.- Specified by:
create
in interfaceIndexOperations
- Returns:
- true if the index was created
-
create
Description copied from interface:IndexOperations
Create an index for given settings.- Specified by:
create
in interfaceIndexOperations
- Parameters:
settings
- the index settings- Returns:
- true if the index was created
-
create
Description copied from interface:IndexOperations
Create an index for given settings and mapping.- Specified by:
create
in interfaceIndexOperations
- Parameters:
settings
- the index settingsmapping
- the index mapping- Returns:
- true if the index was created
-
createWithMapping
public boolean createWithMapping()Description copied from interface:IndexOperations
Create an index with the settings and mapping defined for the entity this IndexOperations is bound to.- Specified by:
createWithMapping
in interfaceIndexOperations
- Returns:
- true if the index was created
-
doCreate
-
delete
public boolean delete()Description copied from interface:IndexOperations
Deletes the index thisIndexOperations
is bound to- Specified by:
delete
in interfaceIndexOperations
- Returns:
- true if the index was deleted
-
exists
public boolean exists()Description copied from interface:IndexOperations
Checks if the index this IndexOperations is bound to exists- Specified by:
exists
in interfaceIndexOperations
- Returns:
- true if the index exists
-
refresh
public void refresh()Description copied from interface:IndexOperations
Refresh the index(es) this IndexOperations is bound to- Specified by:
refresh
in interfaceIndexOperations
-
createMapping
Description copied from interface:IndexOperations
Creates the index mapping for the entity this IndexOperations is bound to.- Specified by:
createMapping
in interfaceIndexOperations
- Returns:
- mapping object
-
createMapping
Description copied from interface:IndexOperations
Creates the index mapping for the given class- Specified by:
createMapping
in interfaceIndexOperations
- Parameters:
clazz
- the clazz to create a mapping for- Returns:
- mapping object
-
putMapping
Description copied from interface:IndexOperations
writes a mapping to the index- Specified by:
putMapping
in interfaceIndexOperations
- Parameters:
mapping
- the Document with the mapping definitions- Returns:
- true if the mapping could be stored
-
getMapping
Description copied from interface:IndexOperations
Get mapping for an index defined by a class.- Specified by:
getMapping
in interfaceIndexOperations
- Returns:
- the mapping
-
createSettings
Description copied from interface:IndexOperations
Creates the index settings for the entity this IndexOperations is bound to.- Specified by:
createSettings
in interfaceIndexOperations
- Returns:
- a settings document.
-
createSettings
Description copied from interface:IndexOperations
Creates the index settings from the annotations on the given class- Specified by:
createSettings
in interfaceIndexOperations
- Parameters:
clazz
- the class to create the index settings from- Returns:
- a settings document.
-
getSettings
Description copied from interface:IndexOperations
Get the index settings.- Specified by:
getSettings
in interfaceIndexOperations
- Returns:
- the settings
-
getSettings
Description copied from interface:IndexOperations
Get the index settings.- Specified by:
getSettings
in interfaceIndexOperations
- Parameters:
includeDefaults
- whether or not to include all the default settings- Returns:
- the settings
-
alias
Description copied from interface:IndexOperations
Executes the givenAliasActions
.- Specified by:
alias
in interfaceIndexOperations
- Parameters:
aliasActions
- the actions to execute- Returns:
- if the operation is acknowledged by Elasticsearch
-
getAliases
Description copied from interface:IndexOperations
gets information about aliases- Specified by:
getAliases
in interfaceIndexOperations
- Parameters:
aliasNames
- alias names, must not be null- Returns:
- a
Map
from index names toAliasData
for that index
-
getAliasesForIndex
Description copied from interface:IndexOperations
gets information about aliases- Specified by:
getAliasesForIndex
in interfaceIndexOperations
- Parameters:
indexNames
- index names, must not be null- Returns:
- a
Map
from index names toAliasData
for that index
-
putTemplate
Description copied from interface:IndexOperations
Creates an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).- Specified by:
putTemplate
in interfaceIndexOperations
- Parameters:
putTemplateRequest
- template request parameters- Returns:
- true if successful
-
getTemplate
Description copied from interface:IndexOperations
gets an index template using the legacy Elasticsearch interface.- Specified by:
getTemplate
in interfaceIndexOperations
- Parameters:
getTemplateRequest
- the request parameters- Returns:
- TemplateData, null if no template with the given name exists.
-
existsTemplate
Description copied from interface:IndexOperations
check if an index template exists using the legacy Elasticsearch interface.- Specified by:
existsTemplate
in interfaceIndexOperations
- Parameters:
existsTemplateRequest
- the request parameters- Returns:
- true if the index exists
-
deleteTemplate
Description copied from interface:IndexOperations
Deletes an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).- Specified by:
deleteTemplate
in interfaceIndexOperations
- Parameters:
deleteTemplateRequest
- template request parameters- Returns:
- true if successful
-
putIndexTemplate
Description copied from interface:IndexOperations
Creates an index template- Specified by:
putIndexTemplate
in interfaceIndexOperations
- Parameters:
putIndexTemplateRequest
- template request parameters- Returns:
- true if successful
-
existsIndexTemplate
Description copied from interface:IndexOperations
check if an index template exists.- Specified by:
existsIndexTemplate
in interfaceIndexOperations
- Parameters:
existsIndexTemplateRequest
- the request parameters- Returns:
- true if the index template exists
-
getIndexTemplate
Description copied from interface:IndexOperations
Gets an index template.- Specified by:
getIndexTemplate
in interfaceIndexOperations
- Parameters:
getIndexTemplateRequest
- the request parameters
-
deleteIndexTemplate
Description copied from interface:IndexOperations
Deletes an index template.- Specified by:
deleteIndexTemplate
in interfaceIndexOperations
- Parameters:
deleteIndexTemplateRequest
- template request parameters- Returns:
- true if successful
-
putComponentTemplate
Description copied from interface:IndexOperations
Writes a component index template that can be used in a composable index template.- Specified by:
putComponentTemplate
in interfaceIndexOperations
- Parameters:
putComponentTemplateRequest
- index template request parameters- Returns:
- true if successful
-
existsComponentTemplate
public boolean existsComponentTemplate(ExistsComponentTemplateRequest existsComponentTemplateRequest) Description copied from interface:IndexOperations
Checks wether a component index template exists.- Specified by:
existsComponentTemplate
in 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:IndexOperations
Get a component template.- Specified by:
getComponentTemplate
in interfaceIndexOperations
- Parameters:
getComponentTemplateRequest
- parameters for the request, may contain wildcard names- Returns:
- the found
TemplateResponse
s, may be empty
-
deleteComponentTemplate
public boolean deleteComponentTemplate(DeleteComponentTemplateRequest deleteComponentTemplateRequest) Description copied from interface:IndexOperations
Deletes the given component index template- Specified by:
deleteComponentTemplate
in interfaceIndexOperations
- Parameters:
deleteComponentTemplateRequest
- request parameters- Returns:
- true if successful.
-
getInformation
Description copied from interface:IndexOperations
Gets theIndexInformation
for the indices defined by #index.- Specified by:
getInformation
in interfaceIndexOperations
- Parameters:
indexCoordinates
- defines the index names to get the information for- Returns:
- a list of
IndexInformation
-
getIndexCoordinates
Description copied from interface:IndexOperations
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.- Specified by:
getIndexCoordinates
in interfaceIndexOperations
- Returns:
- IndexCoordinates
-
getIndexCoordinatesFor
-