public enum SchemaManagementStrategyName extends Enum<SchemaManagementStrategyName>
| Enum Constant and Description |
|---|
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.
|
CREATE_OR_UPDATE
A strategy that creates missing indexes and their schema on startup,
and updates the schema of existing indexes if possible.
|
CREATE_OR_VALIDATE
A strategy that creates missing indexes and their schema on startup,
and validates the schema of existing indexes.
|
DROP_AND_CREATE
A strategy that drops existing indexes and re-creates them and their schema on startup.
|
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.
|
NONE
A strategy that does not do anything on startup or shutdown.
|
VALIDATE
A strategy that does not change indexes nor their schema,
but checks that indexes exist and validates their schema on startup.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getExternalRepresentation() |
static SchemaManagementStrategyName |
of(String value) |
static SchemaManagementStrategyName |
valueOf(String name)
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.
|
public static final SchemaManagementStrategyName NONE
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.
public static final SchemaManagementStrategyName VALIDATE
An exception will be thrown on startup if:
Warning: with the Lucene backend, validation is limited to checking that the indexes exist, because local Lucene indexes don't have a schema.
public static final SchemaManagementStrategyName CREATE
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.
public static final SchemaManagementStrategyName CREATE_OR_VALIDATE
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.
public static final SchemaManagementStrategyName CREATE_OR_UPDATE
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.
public static final SchemaManagementStrategyName DROP_AND_CREATE
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.
public static final SchemaManagementStrategyName DROP_AND_CREATE_AND_DROP
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.
public static SchemaManagementStrategyName[] values()
for (SchemaManagementStrategyName c : SchemaManagementStrategyName.values()) System.out.println(c);
public static SchemaManagementStrategyName valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static SchemaManagementStrategyName of(String value)
public String getExternalRepresentation()
Copyright © 2006-2020 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.