public interface SearchSchemaManager
A SearchSchemaManager targets a pre-defined set of indexed types (and their indexes).
| Modifier and Type | Method and Description |
|---|---|
void |
createIfMissing()
Creates missing indexes and their schema,
but does not touch existing indexes and assumes their schema is correct without validating it.
|
void |
createOrUpdate()
Creates missing indexes and their schema,
and updates the schema of existing indexes if possible.
|
void |
createOrValidate()
Creates missing indexes and their schema,
and validates the schema of existing indexes.
|
void |
dropAndCreate()
Drops existing indexes and re-creates them and their schema.
|
void |
dropIfExisting()
Drops existing indexes.
|
void |
validate()
Does not change indexes nor their schema,
but checks that indexes exist and validates their schema.
|
void validate()
An exception will be thrown if:
Warning: with the Lucene backend, validation is limited to checking that the indexes exist, because local Lucene indexes don't have a schema.
void createIfMissing()
Note that creating indexes or updating their schema will not populate or update the indexed data: a newly created index will always be empty. To populate indexes with pre-existing data, use mass indexing.
void createOrValidate()
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.
void createOrUpdate()
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: 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.
void dropIfExisting()
Note that dropping indexes means losing all indexed data.
void dropAndCreate()
Note that dropping indexes means losing all indexed data, and creating indexes will not populate them: the newly created index will always be empty. To populate indexes with pre-existing data, use mass indexing.
Copyright © 2006-2020 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.