Class AbstractIndexTemplate
java.lang.Object
org.springframework.data.elasticsearch.core.AbstractIndexTemplate
- All Implemented Interfaces:
IndexOperations
Base implementation of
IndexOperations common to Transport and Rest based Implementations of IndexOperations.- Since:
- 4.0
- Author:
- Peter-Josef Meisch, Sascha Woo
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractIndexTemplate(ElasticsearchConverter elasticsearchConverter, Class<?> boundClass) AbstractIndexTemplate(ElasticsearchConverter elasticsearchConverter, IndexCoordinates boundIndex) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 toprotected abstract booleanprotected abstract booleandoDelete(IndexCoordinates index) protected abstract booleandoExists(IndexCoordinates index) doGetAliases(String[] aliasNames, String[] indexNames) doGetMapping(IndexCoordinates index) protected abstract SettingsdoGetSettings(IndexCoordinates index, boolean includeDefaults) protected abstract booleandoPutMapping(IndexCoordinates index, Document mapping) protected abstract voiddoRefresh(IndexCoordinates indexCoordinates) booleanexists()Checks if the index this IndexOperations is bound to existsgetAliases(String... aliasNames) gets information about aliasesgetAliasesForIndex(String... indexNames) gets information about aliasesget the currentIndexCoordinates.getIndexCoordinatesFor(Class<?> clazz) Get mapping for an index defined by a class.Get the index settings.getSettings(boolean includeDefaults) Get the index settings.booleanputMapping(Document mapping) writes a mapping to the indexvoidrefresh()Refresh the index(es) this IndexOperations is bound toMethods 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
alias, deleteComponentTemplate, deleteIndexTemplate, deleteIndexTemplate, deleteTemplate, deleteTemplate, existsComponentTemplate, existsIndexTemplate, existsIndexTemplate, existsTemplate, existsTemplate, getComponentTemplate, getIndexTemplate, getIndexTemplate, getInformation, getInformation, getTemplate, getTemplate, putComponentTemplate, putIndexTemplate, putMapping, putMapping, putTemplate
-
Field Details
-
elasticsearchConverter
-
boundClass
-
-
Constructor Details
-
AbstractIndexTemplate
-
AbstractIndexTemplate
public AbstractIndexTemplate(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
-
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.
-
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
-
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
-
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
-
doDelete
-
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
-
doExists
-
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
-
doPutMapping
-
getMapping
Description copied from interface:IndexOperationsGet mapping for an index defined by a class.- Specified by:
getMappingin interfaceIndexOperations- Returns:
- the mapping
-
doGetMapping
-
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
-
doGetSettings
-
refresh
public void refresh()Description copied from interface:IndexOperationsRefresh the index(es) this IndexOperations is bound to- Specified by:
refreshin interfaceIndexOperations
-
doRefresh
-
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
-
doGetAliases
-
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
-
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.
-
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
-