Reindexing Modes
Liferay 2023.Q4+/GA102+
Reindexing is refreshing all or part of the search index that’s used for searching, and in some cases displaying, Liferay’s content. Execute a reindex from the search administration panel in Global Menu → Control Panel → Search → Index Actions. New reindexing modes are included in the 2023.Q4/GA102 release: Concurrent and Sync. These provide high availability reindexing, so that the reindex process can run while your users continue to search the site’s content, eliminating downtime. Choose from the 3 available reindexing modes:
Reindex Mode | Description | High Availability | Supported Actions |
---|---|---|---|
Full | Deletes the index first, then regenerates it. | ✘ | ✔ Global: all indexes ✔ Global: spell check dictionaries ✔ Single model reindexing |
Concurrent | Creates a new index, leaving the old index in place (i.e., a blue/green reindex) until the new index is ready. | ✔ | ✔ Global: all indexes ✘ Global: spell check dictionaries ✘ Single model reindexing |
Sync | Updates existing search index documents, and deletes stale documents when finished. | ✔ | ✔ Global: all indexes ✘ Global: spell check dictionaries ✔ Single model reindexing |
Concurrent and Sync mode are not available with Solr.
Choosing the Reindex Mode
A full reindex works in any scenario, whether for all content and indexes or a single model. However, it’s not always the best choice. To avoid downtime due to a long running full reindex process, use concurrent or sync mode whenever possible.
Reindex when: | Full | Concurrent () | Sync () |
---|---|---|---|
Installing a new Elasticsearch cluster | ✔ | - | - |
Updating field mappings | ✓ | ✔ | - |
Updating index settings | ✓ | ✔ | - |
Upgrading Liferay | ✓ | ✔ | ✓ |
Upgrading Elasticsearch | ✓ | ✔ | ✓ |
Reindexing after a connection outage | ✓ | ✔ | ✓ |
Reindexing a single model1 | ✓ | - | ✔ |
✔ The mode is recommended for the scenario
✓ The mode is available for the scenario
- The mode is not available for the scenario
In earlier Liferay versions, reindexing always uses full mode, deleting content from the live production index before regenerating it. This can result in significant search index downtime. With concurrent and sync reindex modes, reindexing is accomplished without deleting the index first. Sync mode updates the index in place, while concurrent mode builds a new index in the background, preserving the old one until it’s ready. High availability of the search index means minimal downtime, which means your site’s users can browse and search your site while you reindex the site’s content.
Whenever possible, choose concurrent or sync mode to avoid downtime during a reindex. However, there are considerations to account for when deciding which mode is right in your situation.
Full Reindex Mode
You must use full mode to index all content when connecting to a new, empty Elasticsearch cluster. In this scenario, high availability is not a consideration. You can also use full mode for single model reindexing when sync mode will not suffice, but sync mode is recommended. For high availability reindexing of all indexes, use concurrent mode instead.
A full reindex proceeds this way:
- The original index is deleted.
- A new index is created with the latest index settings and field mappings.
- Documents are regenerated in the index.
Concurrent Reindex Mode
Use concurrent mode for high availability reindexing of all content using a blue/green reindexing strategy. Concurrent mode cannot be used for single model reindexing: instead use sync mode. Concurrent mode serves as a replacement for full reindexing mode when reindexing all content.
A concurrent reindex proceeds this way:
- A new index is created with the latest index settings and field mappings.
- Documents are regenerated in the index.
- The original index is deleted.
Because concurrent reindexing creates a new index alongside the old one, it requires more disk space in the Elasticsearch system’s infrastructure than the other modes. To avoid errors due to insufficient disk space, Liferay estimates whether the available space is sufficient and warns you if it isn’t:
Sync Reindex Mode
Use sync mode for high availability reindexing when primary disk space for Elasticsearch is a concern, or for all high availability single model reindexing needs. There are scenarios when sync mode can’t properly account for system changes, and one of the other modes must be used.
A sync reindex proceeds this way:
- Index documents are updated, but not deleted.
- Stale documents are deleted.
A sync reindex does not take into account updated index settings or mappings, and is therefore more limited than a concurrent reindex.
Setting the Default Reindexing Mode
Full reindex mode is the default. To change it,
-
Go to Global Menu → Control Panel → System Settings.
-
Open the Reindex entry under Platform → Search.
-
Set the Default Reindex Execution Mode and click Update.
-
Reindexing a single model is occasionally required, and sync mode is recommended in these cases. For example, using certain elements while creating a search blueprint and enabling semantic search require reindexing individual model types.
↩