Call Us India :- +91 9925144200       US :- +1 (732) 927-5544       Email us : hello@contcentric.com

Blog

Aug 25

Integration of Remote Elasticsearch 7.X with Liferay DXP 7.2

Liferay is a prominent Content Management System which is adopted by enterprises across the world to build the portals and corporate sites.

Search is a very important and widely used feature of Liferay development. Elasticsearch goes well with Liferay. Liferay architectures either use embedded Elasticsearch or use the Remote Elasticsearch. The experts of the Liferay development services recommend to use the Remote Elasticsearch option as it enhances the search performance of the system. Embedded is not recommended for production environments as it might slow down the performance.

Liferay development company

In this blog, we have provided the steps to be performed to integrate remote Elasticsearch with Liferay DXP 7.2.

1) Check Liferay compatibility matrix for Elastic search version from.

https://www.liferay.com/documents/10182/246659966/Liferay+DXP+7.2+Compatibility+Matrix.pdf/ed234765-db47-c4ad-7c82-2acb4c73b0f9

2) For instance we are using ElasticSearch Version 7.6.2 which can be downloaded from the link below.

https://www.elastic.co/downloads/past-releases/elasticsearch-7-6-2

3) Elasticsearch services basically requires permission of user named elasticsearch user only you can create elasticsearch user with below command.

sudo useradd -m elasticsearch

4) Upgrade Liferay elasticsearch from 6.x to 7.x by downloading Liferay Connector ElasticSearch 7 lpkg plugin from liferay marketplace.

5) To install lpkg, copy the lpkg file to Liferay’s deploy folder and let the file get started.

6) Once the lpkg is started shutdown the server.

7) Blacklist the 6.x elastic search by creating com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config file in server osgi config.

8) In com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config file put the following content.

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” \
]

9) Now clear servers temp, work, osgi/state folders and restart the server (A best practise step,not documented anywhere).

10) Start the server and reindex all searches.

11) create a directory named elasticsearch in /var/lib/ & /var/log/ folder and assign elasticsearch user permission to those directories.

12) Go to /home/elasticsearch/elasticsearch7.6.2/config/elasticsearch.yml file and enter following details.
node.name-anyname,host-127.0.0.1,port-9200

13) Go to /home/elasticsearch/elasticsearch7.6.2/bin and install following plugins using command sudo ./elasticsearch-plugin install <<pluginname>>.

analysis-icu,analysis-kuromoji,analysis-smartcn,analysis-stempel

14) Kill all java processes, if running.

15) Start elasticsearch by going to /home/elasticsearch/elasticsearch7.6.2/bin and using command ./elasticsearch -d

16) Go to Liferay server osgi/config folder create a file named com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config
Enter the following details in this file.

additionalConfigurations=””
additionalIndexConfigurations=””
additionalTypeMappings=””
bootstrapMlockAll=”false”
clientTransportIgnoreClusterName=”false”
clientTransportNodesSamplerInterval=””
clientTransportPingTimeout=””
clientTransportSniff=”true”
clusterName=”LiferayElasticsearchCluster”
discoveryZenPingUnicastHostsPort=”9300-9400″
httpCORSAllowOrigin=”/https?://localhost(:[0-9]+)?/”
httpCORSConfigurations=””
httpCORSEnabled=”true”
httpEnabled=”true”
indexNamePrefix=”liferay-”
indexNumberOfReplicas=””
indexNumberOfShards=””
logExceptionsOnly=”true”
networkBindHost=””
networkHost=””
networkPublishHost=””
operationMode=”REMOTE”
overrideTypeMappings=””
retryOnConflict=”5″
transportAddresses = [ \
“localhost:9300″, \
]
transportTcpPort=””

17) Restart the server and go to search and do reindex all, reindex spell.

That will ensure that the Liferay DXP is running with remote Elasticsearch.

ContCentric is a prominent Liferay development company. We provide customized, robust, and cost-effective content management solutions using the Liferay DXP version to our enterprise clients. Apart from Liferay DXP portal development services and upgrades, we also offer consultancy, support, and maintenance services.

If you want to get a customized portal solution to streamline the content management at your business, then you can drop us a line at hello@contcentric.com. Our expert Liferay consultants will be glad to respond to you for solving the content maze of your organization.

Related bog: Liferay DXP or CMS- What is Preferable for Your Business?

Rashesh Ved

About The Author

Rashesh is a pro in Java. With his sharp development skills, he likes to foray into the challenging customization tasks in Java-based platforms like Alfresco and Liferay. He holds the Alfresco Certification for the Content Services.

Leave a reply

Your email address will not be published. Required fields are marked *