Class SimpleIndexLayoutStrategy
- All Implemented Interfaces:
IndexLayoutStrategy
- Elasticsearch index names follow the format used by Elasticsearch's Rollover API:
<hsearchname>-<6 digits>. See<target-index>here: https://www.elastic.co/guide/en/elasticsearch/reference/7.10/indices-rollover-index.html#rollover-index-api-path-params - The write alias is
<hsearchname>-write. - The read alias is
<hsearchname>-read.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateInitialElasticsearchIndexName(String hibernateSearchIndexName) Generates an initial non-alias Elasticsearch name for an index.createReadAlias(String hibernateSearchIndexName) Generates the read alias for an index.createWriteAlias(String hibernateSearchIndexName) Generates the write alias for an index.extractUniqueKeyFromElasticsearchIndexName(String elasticsearchIndexName) Extracts a unique key from a (non-alias) Elasticsearch index name.extractUniqueKeyFromHibernateSearchIndexName(String hibernateSearchIndexName) Extracts a unique key from a Hibernate Search index name.
-
Field Details
-
NAME
- See Also:
-
UNIQUE_KEY_EXTRACTION_PATTERN
-
-
Constructor Details
-
SimpleIndexLayoutStrategy
public SimpleIndexLayoutStrategy()
-
-
Method Details
-
createInitialElasticsearchIndexName
Description copied from interface:IndexLayoutStrategyGenerates an initial non-alias Elasticsearch name for an index.When
IndexLayoutStrategy.createReadAlias(String)orIndexLayoutStrategy.createWriteAlias(String)returnsnull, this must consistently return the same value for each index, even across multiple executions of the application. Otherwise, the only requirement is that returned names are unique.- Specified by:
createInitialElasticsearchIndexNamein interfaceIndexLayoutStrategy- Parameters:
hibernateSearchIndexName- The Hibernate Search name of an index.- Returns:
- The non-alias Elasticsearch name for this index.
-
createWriteAlias
Description copied from interface:IndexLayoutStrategyGenerates the write alias for an index.This alias will be used when indexing documents, purging the index, ...
This must consistently return the same value for each index, even across multiple executions of the application.
If you do not want to use aliases for write operations, return
null: the non-alias name returned byIndexLayoutStrategy.createInitialElasticsearchIndexName(String)will be used instead.- Specified by:
createWriteAliasin interfaceIndexLayoutStrategy- Parameters:
hibernateSearchIndexName- The Hibernate Search name of an index.- Returns:
- The write alias for this index.
-
createReadAlias
Description copied from interface:IndexLayoutStrategyGenerates the read alias for an index.This alias will be used when executing search queries.
This must consistently return the same value for each index, even across multiple executions of the application.
If you do not want to use aliases for read operations, return
null: the non-alias name returned byIndexLayoutStrategy.createInitialElasticsearchIndexName(String)will be used instead.- Specified by:
createReadAliasin interfaceIndexLayoutStrategy- Parameters:
hibernateSearchIndexName- The Hibernate Search name of an index.- Returns:
- The read alias for this index.
-
extractUniqueKeyFromHibernateSearchIndexName
Description copied from interface:IndexLayoutStrategyExtracts a unique key from a Hibernate Search index name.Optional operation: this method only has to be implemented when using the
index-nametype-name mapping strategy.This method will be called once per index on bootstrap.
The returned key must be consistent with the key returned by
IndexLayoutStrategy.extractUniqueKeyFromElasticsearchIndexName(String).- Specified by:
extractUniqueKeyFromHibernateSearchIndexNamein interfaceIndexLayoutStrategy- Parameters:
hibernateSearchIndexName- The Hibernate Search name of an index.- Returns:
- The unique key assigned to that index.
-
extractUniqueKeyFromElasticsearchIndexName
Description copied from interface:IndexLayoutStrategyExtracts a unique key from a (non-alias) Elasticsearch index name.Optional operation: this method only has to be implemented when using the
index-nametype-name mapping strategy.This method will be called once per index on bootstrap.
The returned key must be consistent with the key returned by
IndexLayoutStrategy.extractUniqueKeyFromHibernateSearchIndexName(String).- Specified by:
extractUniqueKeyFromElasticsearchIndexNamein interfaceIndexLayoutStrategy- Parameters:
elasticsearchIndexName- A primary index name extracted from an Elasticsearch response.- Returns:
- The unique key assigned to that index.
-