Allow configuration for Application-driven index settings
Priority
Components
Affects versions
Fix versions
Description
Activity

Tibor Lipusz June 3, 2020 at 3:15 AMEdited
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.
Go to
[Liferay Home]/osgi/marketplace
and find Liferay Foundation - Liferay Search Tuning - Impl.lpkg.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):Next locate the Liferay Forms and Workflow - Liferay Portal Workflow - Impl.lpkg
Open the LPKG with an archive manager and extract the following JAR file into
Liferay Home/osgi/marketplace/override
:Go to
Liferay Home/osgi/marketplace/override
and remove the version (e.g., 1.0.21) from the name of all the JAR filesOpen com.liferay.portal.search.tuning.rankings.web.jar with an archive manager
Navigate to META-INF/search and open
liferay-search-tuning-rankings-index.json
with a text editor.Edit the "settings" snippet and add update the settings as you want
Save the file and let your archive manager re-package the JAR automatically.
Do the same for
com.liferay.portal.search.tuning.synonyms.web.jar
Do the same for
com.liferay.portal.workflow.metrics.service.jar
(the name of the file issettings.json
and its content and structure may be different from the Search Tuning settings).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 AMEdited
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
Details
Assignee

Reporter

Zendesk Support
Linked Tickets
Zendesk Support

App indexes, such as commerce-ml-*, search-tuning-* and workflow-metrics-* etc. use hard coded index settings ie:
modules/dxp/apps/commerce/commerce-machine-learning-impl/src/main/resources/META-INF/search/settings.json
modules/dxp/apps/portal-search-tuning/portal-search-tuning-rankings-web/src/main/resources/META-INF/search/liferay-search-tuning-rankings-index.json
modules/dxp/apps/portal-search-tuning/portal-search-tuning-synonyms-web/src/main/resources/META-INF/search/liferay-search-tuning-synonyms-index.json
modules/dxp/apps/portal-workflow/portal-workflow-metrics-service/src/main/resources/META-INF/search/settings.json
There should be a way to configure these indexes for the search app indexes which can be used as a pattern for other app indexes.