Package io.jmix.search.index.impl
Class ESIndexManagerImpl
java.lang.Object
io.jmix.search.index.impl.ESIndexManagerImpl
- All Implemented Interfaces:
ESIndexManager
@Component("search_ESIndexManager")
public class ESIndexManagerImpl
extends Object
implements ESIndexManager
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.elasticsearch.client.RestHighLevelClient
protected IndexConfigurationManager
protected IndexStateRegistry
protected com.fasterxml.jackson.databind.ObjectMapper
protected SearchProperties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
createIndex
(IndexConfiguration indexConfiguration) Creates index if not exists using providedIndexConfiguration
.boolean
Drops index by name.org.elasticsearch.client.indices.GetIndexResponse
Requests info about index from ES cluster.protected IndexSynchronizationStatus
handleIrrelevantIndex
(IndexConfiguration indexConfiguration, IndexSchemaManagementStrategy strategy) protected IndexSynchronizationStatus
handleMissingIndex
(IndexConfiguration indexConfiguration, IndexSchemaManagementStrategy strategy) protected boolean
isIndexActual
(IndexConfiguration indexConfiguration) boolean
isIndexExist
(String indexName) Checks if index exists.protected boolean
isIndexMappingActual
(IndexConfiguration indexConfiguration, org.elasticsearch.client.indices.GetIndexResponse indexResponse) protected boolean
isIndexSettingsActual
(IndexConfiguration indexConfiguration, org.elasticsearch.client.indices.GetIndexResponse indexResponse) boolean
recreateIndex
(IndexConfiguration indexConfiguration) Drops and creates search index using providedIndexConfiguration
.Drops and creates all search indexes.recreateIndexes
(Collection<IndexConfiguration> indexConfigurations) Drops and creates search indexes using provided collection ofIndexConfiguration
.synchronizeIndexSchema
(IndexConfiguration indexConfiguration) Synchronizes schema of search index for providedIndexConfiguration
.protected IndexSynchronizationStatus
synchronizeIndexSchema
(IndexConfiguration indexConfiguration, IndexSchemaManagementStrategy strategy) Synchronizes schemas of all search indexes defined in application.synchronizeIndexSchemas
(Collection<IndexConfiguration> indexConfigurations) Synchronizes schemas of search indexes for provided collection ofIndexConfiguration
.validateIndex
(IndexConfiguration indexConfiguration) Validates current state of index schema.Validates current state of schema of all search indexes defined in application.validateIndexes
(Collection<IndexConfiguration> indexConfigurations) Validates current state of index schema related to provided collection ofIndexConfiguration
.
-
Field Details
-
esClient
@Autowired protected org.elasticsearch.client.RestHighLevelClient esClient -
indexConfigurationManager
-
searchProperties
-
indexStateRegistry
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
ESIndexManagerImpl
public ESIndexManagerImpl()
-
-
Method Details
-
createIndex
Description copied from interface:ESIndexManager
Creates index if not exists using providedIndexConfiguration
.- Specified by:
createIndex
in interfaceESIndexManager
- Parameters:
indexConfiguration
- index configuration- Returns:
- true if index was successfully created, false otherwise
-
dropIndex
Description copied from interface:ESIndexManager
Drops index by name.- Specified by:
dropIndex
in interfaceESIndexManager
- Parameters:
indexName
- index name- Returns:
- true if index was successfully dropped, false otherwise
-
recreateIndexes
Description copied from interface:ESIndexManager
Drops and creates all search indexes.- Specified by:
recreateIndexes
in interfaceESIndexManager
- Returns:
- Map with operation result per every index configuration
-
recreateIndexes
public Map<IndexConfiguration,Boolean> recreateIndexes(Collection<IndexConfiguration> indexConfigurations) Description copied from interface:ESIndexManager
Drops and creates search indexes using provided collection ofIndexConfiguration
.- Specified by:
recreateIndexes
in interfaceESIndexManager
- Parameters:
indexConfigurations
- index configurations- Returns:
- Map with operation result per every index configuration
-
recreateIndex
Description copied from interface:ESIndexManager
Drops and creates search index using providedIndexConfiguration
.- Specified by:
recreateIndex
in interfaceESIndexManager
- Parameters:
indexConfiguration
- index configuration- Returns:
- true if index was successfully recreated, false otherwise
-
isIndexExist
Description copied from interface:ESIndexManager
Checks if index exists.- Specified by:
isIndexExist
in interfaceESIndexManager
- Parameters:
indexName
- index name- Returns:
- true if index exists, false otherwise
-
validateIndexes
Description copied from interface:ESIndexManager
Validates current state of schema of all search indexes defined in application.- Specified by:
validateIndexes
in interfaceESIndexManager
- Returns:
IndexValidationStatus
per eachIndexConfiguration
-
validateIndexes
public Map<IndexConfiguration,IndexValidationStatus> validateIndexes(Collection<IndexConfiguration> indexConfigurations) Description copied from interface:ESIndexManager
Validates current state of index schema related to provided collection ofIndexConfiguration
.- Specified by:
validateIndexes
in interfaceESIndexManager
- Parameters:
indexConfigurations
- actual configurations- Returns:
IndexValidationStatus
per eachIndexConfiguration
-
validateIndex
Description copied from interface:ESIndexManager
Validates current state of index schema.- Specified by:
validateIndex
in interfaceESIndexManager
- Parameters:
indexConfiguration
- actual configuration- Returns:
IndexValidationStatus
-
getIndex
Description copied from interface:ESIndexManager
Requests info about index from ES cluster.- Specified by:
getIndex
in interfaceESIndexManager
- Parameters:
indexName
- index name- Returns:
- response
-
synchronizeIndexSchemas
Description copied from interface:ESIndexManager
Synchronizes schemas of all search indexes defined in application.See
ESIndexManager.synchronizeIndexSchemas(Collection)
See
ESIndexManager.synchronizeIndexSchema(IndexConfiguration)
- Specified by:
synchronizeIndexSchemas
in interfaceESIndexManager
- Returns:
IndexSynchronizationStatus
per eachIndexConfiguration
-
synchronizeIndexSchemas
public Map<IndexConfiguration,IndexSynchronizationStatus> synchronizeIndexSchemas(Collection<IndexConfiguration> indexConfigurations) Description copied from interface:ESIndexManager
Synchronizes schemas of search indexes for provided collection ofIndexConfiguration
.See
ESIndexManager.synchronizeIndexSchema(IndexConfiguration)
- Specified by:
synchronizeIndexSchemas
in interfaceESIndexManager
- Parameters:
indexConfigurations
- actual index configurations- Returns:
IndexSynchronizationStatus
per eachIndexConfiguration
-
synchronizeIndexSchema
Description copied from interface:ESIndexManager
Synchronizes schema of search index for providedIndexConfiguration
.It tries to update schema to the actual state according to
IndexSchemaManagementStrategy
defined by 'jmix.search.indexSchemaManagementStrategy' application property.- Specified by:
synchronizeIndexSchema
in interfaceESIndexManager
- Parameters:
indexConfiguration
- actual index configuration- Returns:
IndexSynchronizationStatus
-
synchronizeIndexSchema
protected IndexSynchronizationStatus synchronizeIndexSchema(IndexConfiguration indexConfiguration, IndexSchemaManagementStrategy strategy) -
handleIrrelevantIndex
protected IndexSynchronizationStatus handleIrrelevantIndex(IndexConfiguration indexConfiguration, IndexSchemaManagementStrategy strategy) -
handleMissingIndex
protected IndexSynchronizationStatus handleMissingIndex(IndexConfiguration indexConfiguration, IndexSchemaManagementStrategy strategy) -
isIndexActual
-
isIndexMappingActual
protected boolean isIndexMappingActual(IndexConfiguration indexConfiguration, org.elasticsearch.client.indices.GetIndexResponse indexResponse) -
isIndexSettingsActual
protected boolean isIndexSettingsActual(IndexConfiguration indexConfiguration, org.elasticsearch.client.indices.GetIndexResponse indexResponse)
-