Search Configuration Options

Index Creation

The Search add-on checks the current configuration of Elasticsearch indexes and compares it to the expected ones. Further actions depend on the selected Index Schema Management Strategy:

  • create-only - every missing index will be created, existing indexes with irrelevant configuration will be kept as is.

  • create-or-recreate - every missing index will be created, existing indexes with irrelevant configuration will be recreated (all data will be lost). This is the default strategy.

The strategy can be configured by adding the following property to your application.properties file:

jmix.search.index-schema-management-strategy = create-only

The index schema synchronization is automatically performed on application startup. Besides, it can be manually performed using synchronizeXXX operations of EntityIndexing MBean.

The EntityIndexing MBean also contains the recreateIndex operation. It drops and creates index without taking into account the current Index Schema Management Strategy, even if the target index has an actual configuration. All index data will be lost.

Index Naming

Search indexes have the following naming template: <prefix><entity_name>.

Default prefix is search_index_.

If multiple projects use the same Elasticsearch service, you should ensure that index names are unique: all projects should have unique entity names or projects should have different prefixes.

Prefixes can be configured by adding the following property to your application.properties file:

jmix.search.search-index-name-prefix = sample_prefix_

Existing Data Indexing

There are two approaches to existing data indexing:

  • Automatic - is a part of the index schema synchronization and enabled by default. It enqueues all instances of each entity whose index has been created (in the background process). Automatic indexing can be enabled for specific entities only.

  • Manual - by using the enqueueIndexAll operation of EntityIndexing MBean.

To enable automatic indexing for specific entities, add the following application property:

jmix.search.enqueue-index-all-on-startup-index-recreation-entities = search_Order,search_Customer

Also, you can completely disable automatic indexing by adding the following application property:

jmix.search.enqueue-index-all-on-startup-index-recreation-enabled = false

Entities Tracking

By default, the system tracks changes of indexed entities. It stores information about all entity instances affected by the changes to the indexing queue.

This behavior can be disabled by adding the following application property:

jmix.search.changed-entities-indexing-enabled = false