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
-
Constructor Summary
ConstructorDescriptionAbstractIndexTemplate
(ElasticsearchConverter elasticsearchConverter, Class<?> boundClass) AbstractIndexTemplate
(ElasticsearchConverter elasticsearchConverter, IndexCoordinates boundIndex) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 toprotected abstract boolean
protected abstract boolean
doDelete
(IndexCoordinates index) protected abstract boolean
doExists
(IndexCoordinates index) doGetAliases
(String[] aliasNames, String[] indexNames) doGetMapping
(IndexCoordinates index) protected abstract Settings
doGetSettings
(IndexCoordinates index, boolean includeDefaults) protected abstract boolean
doPutMapping
(IndexCoordinates index, Document mapping) protected abstract void
doRefresh
(IndexCoordinates indexCoordinates) boolean
exists()
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.boolean
putMapping
(Document mapping) writes a mapping to the indexvoid
refresh()
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, wait
Methods inherited from interface org.springframework.data.elasticsearch.core.IndexOperations
alias, deleteTemplate, deleteTemplate, existsTemplate, existsTemplate, getInformation, getInformation, getTemplate, getTemplate, 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:IndexOperations
Create an index.- Specified by:
create
in interfaceIndexOperations
- Returns:
- true if the index was created
-
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.
-
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
-
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
-
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
-
doDelete
-
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
-
doExists
-
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
-
doPutMapping
-
getMapping
Description copied from interface:IndexOperations
Get mapping for an index defined by a class.- Specified by:
getMapping
in interfaceIndexOperations
- Returns:
- the mapping
-
doGetMapping
-
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
-
doGetSettings
-
refresh
public void refresh()Description copied from interface:IndexOperations
Refresh the index(es) this IndexOperations is bound to- Specified by:
refresh
in interfaceIndexOperations
-
doRefresh
-
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
-
doGetAliases
-
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
-
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.
-
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
-