Announcements

Upgrading Elasticsearch on Liferay PaaS

02/04/24 20:15

ja


Note: please note that Liferay has renamed its Liferay Experience Could offerings to Liferay SaaS (formerly LXC) and Liferay PaaS (formerly LXC-SM).

Summary

Moving from one version of search to another in a Liferay PaaS environment takes a few more steps than simply updating the LCP.json. This article covers the additional steps needed to complete a smooth search upgrade.

DXP 7.2

By default, DXP 7.2 is set up to work with Elasticsearch 6. This means that the bundled connector application and APIs are for Elasticsearch 6. These must be disabled before installing the Elasticsearch 7 connector.

Step 1: Update LCP.json

Update search/LCP.json to the new ES 7.x version and follow the below steps. (eg: "image": "liferaycloud/elasticsearch:7.17.18-5.3.0")

# search/LCP.json
{
"kind": "StatefulSet",
"id": "search",
"image": "liferaycloud/elasticsearch:7.17.18-5.3.0",
[...]
}

Step 2: Blacklisting the Elasticsearch 6 connector

Create a .config file with the following name

com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config

Add the following content to the .config file and place it in the liferay/configs/[ENV]/osgi/configs/ filepath

blacklistBundleSymbolicNames=[ \
"com.liferay.portal.search.elasticsearch6.api", \
"com.liferay.portal.search.elasticsearch6.impl", \
"com.liferay.portal.search.elasticsearch6.spi", \
"com.liferay.portal.search.elasticsearch6.xpack.security.impl", \
"Liferay Connector to X-Pack Security [Elastic Stack 6.x] - Impl", \
"Liferay Enterprise Search Security - Impl.lpkg" \
]

Step 3: Install the Elasticsearch 7 Connector

Download the Liferay Connector to Elasticsearch 7 according to Liferay DXP 7.2 and Elasticsearch server version(Compatibility Matrix). Unzip the downloaded lpkg file and place the extracted lpkg files in liferay/configs/[ENV]/osgi/marketplace/ filepath.

Step 4: Configure the Connector for Liferay 7.2

Create a .config file with the following name

com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config

Add the following content to the .config file and place it in the liferay/configs/[ENV]/osgi/configs/ filepath

operationMode="REMOTE"
indexNamePrefix="liferay-"
transportAddresses="search:9300"
clusterName="liferay_cluster"

The liferay/configs/[ENV]/ folder should now look like this

|- osgi
| |- configs
| | |- com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config
| | |- com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config
| |- marketplace
| | |- Liferay Connector to Elasticsearch 7 - API.1pkg
| | |- Liferay Connector to Elasticsearch 7 - Impl.lpkg
| | |- Liferay Connector to Elasticsearch 7 - SPI.lpkg

Step 5: Startup and Reindex

Perform the following steps to confirm that the installation completed successfully and the site is indexed.

  1. Confirm that the following blacklisted bundle messages appear in the startup logs
    1. INFO [ModuleFramework-Static-Bundles-2][BundleBlacklist:188] Stopping blacklisted bundle com.liferay.portal.search.elasticsearch6.impl_3.0.101
      INFO [ModuleFramework-Static-Bundles-2][BundleBlacklist:188] Stopping blacklisted bundle com.liferay.portal.search.elasticsearch6.api_3.1.15 [512]
      INFO [ModuleFramework-Static-Bundles-2][BundleBlacklist:188] Stopping blacklisted bundle com.liferay.portal.search.elasticsearch6.spi_4.0.1 [843]
  2. Navigate to Control Panel → Configuration → Search → Index Actions and verify the Elasticsearch version is updated
  3. In the same section of the Control Panel, click the Execute button to Reindex all search indexes and then Reindex all spell check indexes one by one to reindex the portal completely

DXP 7.3 and 7.4

Only step 1 and step 5 from the above section are needed when upgrading Elasticsearch on 7.3 and 7.4.