Allow configuration for Application-driven index settings

Activity

Show:

Tibor Lipusz June 3, 2020 at 3:15 AM
Edited

Workaround for new deployments: Overriding LPKG files to customize default settings for Search Tuning and Workflow Metrics indexes

You can customize the default index settings of the out-of-the-box Liferay app-driven indexes by leveraging the overriding LPKG files mechanism. By doing so, you can ensure that when DXP starts up, the OOTB app-driven indexes will be created with the required settings. This can come in handy for new DXP deployments.

The steps below assume that you are building a new DXP 7.2 environment and your Elasticsearch cluster node is empty: it should not contain any liferay-* or workflow-* indexes.

  1. Go to [Liferay Home]/osgi/marketplace and find Liferay Foundation - Liferay Search Tuning - Impl.lpkg.

  2. Open the LPKG with an archive manager and extract the following JAR files into Liferay Home/osgi/marketplace/override (create the override folder if it does not exist):

  3. Next locate the Liferay Forms and Workflow - Liferay Portal Workflow - Impl.lpkg

  4. Open the LPKG with an archive manager and extract the following JAR file into Liferay Home/osgi/marketplace/override:

  5. Go to Liferay Home/osgi/marketplace/override and remove the version (e.g., 1.0.21) from the name of all the JAR files

  6. Open com.liferay.portal.search.tuning.rankings.web.jar with an archive manager

    1. Navigate to META-INF/search and open liferay-search-tuning-rankings-index.json with a text editor.

    2. Edit the "settings" snippet and add update the settings as you want

    3. Save the file and let your archive manager re-package the JAR automatically.

  7. Do the same for com.liferay.portal.search.tuning.synonyms.web.jar

  8. Do the same for com.liferay.portal.workflow.metrics.service.jar (the name of the file is settings.json and its content and structure may be different from the Search Tuning settings).

  9. Start Liferay DXP.

Verify through Elasticsearch REST API calls or through Kibana (or the X-Pack Monitoring widget) that the index settings of the app-driven indexes are the same as what you defined in the overriding JAR files.

Unlike the Company indexes ("liferay-0", "liferay-<companyId>") app-driven indexes may not be dropped and re-created upon a full-reindex. However it is still recommended to update your override files (merge the content) with any new settings from the official JAR archives when you install a new Fix Pack or Hotfix to make sure your settings are consistent.

(Note: content in the Workflow Metrics indexex are re-indexed, but the indexes are re-created only if they're missing.)

Tibor Lipusz May 18, 2020 at 11:05 AM
Edited

Notes:

Indeed, if someone wants to go with a different "replicas" settings and

is not suitable for them either, they have to execute a curl request for each index to update: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html, but they have to perform this only one time per each index as the settings are replicated across the cluster nodes automatically.

However, the number of shards can't be changed after index creation (only the replicas are allowed) and unfortunately they can't use the https://www.elastic.co/guide/en/elasticsearch/reference/6.8/indices-templates.html feature because as the documentation notes

When using the create index API, the settings/mappings defined as part of the create index call will take precedence over any matching settings/mappings defined in the template.

Details

Assignee

Reporter

Zendesk Support

Created May 5, 2020 at 10:25 AM
Updated January 28, 2025 at 6:17 PM
Loading...