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
FieldsModifier and TypeFieldDescriptionprotected org.elasticsearch.client.RestHighLevelClientprotected IndexConfigurationManagerprotected IndexStateRegistryprotected com.fasterxml.jackson.databind.ObjectMapperprotected SearchProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancreateIndex(IndexConfiguration indexConfiguration) Creates index if not exists using providedIndexConfiguration.booleanDrops index by name.org.elasticsearch.client.indices.GetIndexResponseRequests info about index from ES cluster.protected IndexSynchronizationStatushandleIrrelevantIndex(IndexConfiguration indexConfiguration, IndexSchemaManagementStrategy strategy) protected IndexSynchronizationStatushandleMissingIndex(IndexConfiguration indexConfiguration, IndexSchemaManagementStrategy strategy) protected booleanisIndexActual(IndexConfiguration indexConfiguration) booleanisIndexExist(String indexName) Checks if index exists.protected booleanisIndexMappingActual(IndexConfiguration indexConfiguration, org.elasticsearch.client.indices.GetIndexResponse indexResponse) protected booleanisIndexSettingsActual(IndexConfiguration indexConfiguration, org.elasticsearch.client.indices.GetIndexResponse indexResponse) booleanrecreateIndex(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 IndexSynchronizationStatussynchronizeIndexSchema(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:ESIndexManagerCreates index if not exists using providedIndexConfiguration.- Specified by:
createIndexin interfaceESIndexManager- Parameters:
indexConfiguration- index configuration- Returns:
- true if index was successfully created, false otherwise
-
dropIndex
Description copied from interface:ESIndexManagerDrops index by name.- Specified by:
dropIndexin interfaceESIndexManager- Parameters:
indexName- index name- Returns:
- true if index was successfully dropped, false otherwise
-
recreateIndexes
Description copied from interface:ESIndexManagerDrops and creates all search indexes.- Specified by:
recreateIndexesin interfaceESIndexManager- Returns:
- Map with operation result per every index configuration
-
recreateIndexes
public Map<IndexConfiguration,Boolean> recreateIndexes(Collection<IndexConfiguration> indexConfigurations) Description copied from interface:ESIndexManagerDrops and creates search indexes using provided collection ofIndexConfiguration.- Specified by:
recreateIndexesin interfaceESIndexManager- Parameters:
indexConfigurations- index configurations- Returns:
- Map with operation result per every index configuration
-
recreateIndex
Description copied from interface:ESIndexManagerDrops and creates search index using providedIndexConfiguration.- Specified by:
recreateIndexin interfaceESIndexManager- Parameters:
indexConfiguration- index configuration- Returns:
- true if index was successfully recreated, false otherwise
-
isIndexExist
Description copied from interface:ESIndexManagerChecks if index exists.- Specified by:
isIndexExistin interfaceESIndexManager- Parameters:
indexName- index name- Returns:
- true if index exists, false otherwise
-
validateIndexes
Description copied from interface:ESIndexManagerValidates current state of schema of all search indexes defined in application.- Specified by:
validateIndexesin interfaceESIndexManager- Returns:
IndexValidationStatusper eachIndexConfiguration
-
validateIndexes
public Map<IndexConfiguration,IndexValidationStatus> validateIndexes(Collection<IndexConfiguration> indexConfigurations) Description copied from interface:ESIndexManagerValidates current state of index schema related to provided collection ofIndexConfiguration.- Specified by:
validateIndexesin interfaceESIndexManager- Parameters:
indexConfigurations- actual configurations- Returns:
IndexValidationStatusper eachIndexConfiguration
-
validateIndex
Description copied from interface:ESIndexManagerValidates current state of index schema.- Specified by:
validateIndexin interfaceESIndexManager- Parameters:
indexConfiguration- actual configuration- Returns:
IndexValidationStatus
-
getIndex
Description copied from interface:ESIndexManagerRequests info about index from ES cluster.- Specified by:
getIndexin interfaceESIndexManager- Parameters:
indexName- index name- Returns:
- response
-
synchronizeIndexSchemas
Description copied from interface:ESIndexManagerSynchronizes schemas of all search indexes defined in application.See
ESIndexManager.synchronizeIndexSchemas(Collection)See
ESIndexManager.synchronizeIndexSchema(IndexConfiguration)- Specified by:
synchronizeIndexSchemasin interfaceESIndexManager- Returns:
IndexSynchronizationStatusper eachIndexConfiguration
-
synchronizeIndexSchemas
public Map<IndexConfiguration,IndexSynchronizationStatus> synchronizeIndexSchemas(Collection<IndexConfiguration> indexConfigurations) Description copied from interface:ESIndexManagerSynchronizes schemas of search indexes for provided collection ofIndexConfiguration.See
ESIndexManager.synchronizeIndexSchema(IndexConfiguration)- Specified by:
synchronizeIndexSchemasin interfaceESIndexManager- Parameters:
indexConfigurations- actual index configurations- Returns:
IndexSynchronizationStatusper eachIndexConfiguration
-
synchronizeIndexSchema
Description copied from interface:ESIndexManagerSynchronizes schema of search index for providedIndexConfiguration.It tries to update schema to the actual state according to
IndexSchemaManagementStrategydefined by 'jmix.search.indexSchemaManagementStrategy' application property.- Specified by:
synchronizeIndexSchemain 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)
-