Enum SchemaManagementStrategyName
- All Implemented Interfaces:
Serializable
,Comparable<SchemaManagementStrategyName>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA strategy that creates missing indexes and their schema on startup, but does not touch existing indexes and assumes their schema is correct without validating it.A strategy that creates missing indexes and their schema on startup, and updates the schema of existing indexes if possible.A strategy that creates missing indexes and their schema on startup, and validates the schema of existing indexes.A strategy that drops existing indexes and re-creates them and their schema on startup.A strategy that drops existing indexes and re-creates them and their schema on startup, then drops the indexes on shutdown.A strategy that does not do anything on startup or shutdown.A strategy that does not change indexes nor their schema, but checks that indexes exist and validates their schema on startup. -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaManagementStrategyName
static SchemaManagementStrategyName
Returns the enum constant of this type with the specified name.static SchemaManagementStrategyName[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NONE
A strategy that does not do anything on startup or shutdown.Indexes and their schema will not be created nor deleted on startup or shutdown. Hibernate Search will not even check that the index actually exists.
With Elasticsearch, indexes and their schema will have to be created explicitly.
-
VALIDATE
A strategy that does not change indexes nor their schema, but checks that indexes exist and validates their schema on startup.An exception will be thrown on startup if:
- Indexes are missing
- OR, with Elasticsearch only, indexes exist but their schema does not match the requirements of the Hibernate Search mapping: missing fields, fields with incorrect type, missing analyzer definitions or normalizer definitions, ...
Warning: with the Lucene backend, validation is limited to checking that the indexes exist, because local Lucene indexes don't have a schema.
-
CREATE
A strategy that creates missing indexes and their schema on startup, but does not touch existing indexes and assumes their schema is correct without validating it.Note that creating indexes and their schema will not populate the indexed data: a newly created index will always be empty. To populate indexes with pre-existing data, use mass indexing.
-
CREATE_OR_VALIDATE
A strategy that creates missing indexes and their schema on startup, and validates the schema of existing indexes.Note that creating indexes and their schema will not populate the indexed data: newly created indexes will always be empty. To populate indexes with pre-existing data, use mass indexing.
With Elasticsearch only, an exception will be thrown on startup if some indexes already exist but their schema does not match the requirements of the Hibernate Search mapping: missing fields, fields with incorrect type, missing analyzer definitions or normalizer definitions, ...
Warning: with the Lucene backend, validation is limited to checking that the indexes exist, because local Lucene indexes don't have a schema.
-
CREATE_OR_UPDATE
A strategy that creates missing indexes and their schema on startup, and updates the schema of existing indexes if possible.Note that creating indexes or updating their schema will not populate or update the indexed data: newly created indexes will always be empty. To populate indexes with pre-existing data, use mass indexing.
Note: with the Lucene backend, schema update is a no-op, because local Lucene indexes don't have a schema.
Warning: This strategy is unfit for production environments, due to the limitations explained below. It should only be relied upon during development, to easily add new fields to an existing index.
Warning: with the Elasticsearch backend, if analyzer/normalizer definitions have to be updated, the index will be closed automatically during the update.
Warning: with the Elasticsearch backend, many scenarios can cause schema updates to fail: a field changed its type from string to integer, an analyzer definition changed, ... In such cases, the only workaround is to drop and re-create the index.
-
DROP_AND_CREATE
A strategy that drops existing indexes and re-creates them and their schema on startup.Note that dropping indexes means losing all indexed data, and creating indexes will not populate them: the newly created indexes will always be empty. To populate indexes with pre-existing data, use mass indexing.
-
DROP_AND_CREATE_AND_DROP
A strategy that drops existing indexes and re-creates them and their schema on startup, then drops the indexes on shutdown.Note that dropping indexes means losing all indexed data, and creating indexes will not populate them: the newly created indexes will always be empty. To populate indexes with pre-existing data, use mass indexing.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
of
-
externalRepresentation
- Returns:
- The expected string representation in configuration properties.
-