Class NoAliasIndexLayoutStrategy
- java.lang.Object
-
- org.hibernate.search.backend.elasticsearch.index.layout.impl.NoAliasIndexLayoutStrategy
-
- All Implemented Interfaces:
IndexLayoutStrategy
public final class NoAliasIndexLayoutStrategy extends Object implements IndexLayoutStrategy
A no-alias layout strategy for indexes:- The Elasticsearch index name is identical to the Hibernate Search index names.
- There is no write alias.
- There is no read alias.
-
-
Constructor Summary
Constructors Constructor Description NoAliasIndexLayoutStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateInitialElasticsearchIndexName(String hibernateSearchIndexName)Generates an initial non-alias Elasticsearch name for an index.StringcreateReadAlias(String hibernateSearchIndexName)Generates the read alias for an index.StringcreateWriteAlias(String hibernateSearchIndexName)Generates the write alias for an index.StringextractUniqueKeyFromElasticsearchIndexName(String elasticsearchIndexName)Extracts a unique key from a (non-alias) Elasticsearch index name.StringextractUniqueKeyFromHibernateSearchIndexName(String hibernateSearchIndexName)Extracts a unique key from a Hibernate Search index name.
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
createInitialElasticsearchIndexName
public String createInitialElasticsearchIndexName(String hibernateSearchIndexName)
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
public String createWriteAlias(String hibernateSearchIndexName)
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
public String createReadAlias(String hibernateSearchIndexName)
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
public String extractUniqueKeyFromHibernateSearchIndexName(String hibernateSearchIndexName)
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
public String extractUniqueKeyFromElasticsearchIndexName(String elasticsearchIndexName)
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.
-
-