« Back

Configure Elasticsearch on external server with liferay 7/DXP

Liferay is an open source project so there is no confusion that whatever search engine it has must be an open source project as well. Elasticsearch is a highly scalable, full-text search and analytics engine bind with liferay portal.

As a default liferay portal runs Elasticsearch as an EMBEDDED search engine, but it is only supported in production locally or remotely, as a separate server or cluster setup this blog will helps you.

Prerequisite: Basic of Liferay 7 DXP. Make sure you have JAVA 8 or above.

Configuring Elasticsearch in liferay portal is pretty easy with 6 steps only:

Step 1: Find right version of Elasticsearch:

In first step you have to find out right version of Elasticsearch for you liferay portal, For that If your liferay isn’t working then start it first.

Hit following URL which shows you current embedded Elasticsearch version running in your liferay portal:

http://localhost:9200

 

In response, You will get JSON document which may be varies slightly, but it looks similar to below JSON

{
  "name" : "Ardina",
  "cluster_name" : "st_abd_cluster",
  "version" : {
    "number" : "2.2.0",
    "build_hash" : "8ff36d139e16f8720f2947ef62c8167a888992fe",
    "build_timestamp" : "2016-01-27T13:32:39Z",
    "build_snapshot" : false,
    "lucene_version" : "5.4.1"
  },
  "tagline" : "You Know, for Search"
}

 

The version of Elasticsearch which you want is set in “number” field. In this example, It’s “2.2.0”.

Now you know which version you need, Click here and Download that version.

Step 2: Install Elasticsearch:

In this step you will decide where you want to install the Elasticsearch in local with liferay or on remote server. I am using ubuntu 14.04 VM as standalone server and pointing it from my local liferay portal.

  • Now, You have copy of right Elasticsearch version, Extract it to the folder where you want it to be running.

Note: We will refer Elasticsearch home directory as [<ESH>] in this blog

Step 3: Install Elasticsearch plugins:

Use the following command to install required Elasticsearch plugin. First navigate to []/bin directory and then perform following commands.

  1. Install analysis-icu plugin

./plugin install analysis-icu

 

  1. Install analysis-kuromoji plugin

./plugin install analysis-kuromoji

 

  1. Install analysis-smartcn plugin

./plugin install analysis-smartcn

 

  1. Install analysis-stempel plugin

./plugin install analysis-stempel

Step 4: Configure Elasticsearch configurations:

For setting of elasticsearch configuration you need to edit [<ESH>]/config/elasticsearch.yml file. Name your cluster and point it to system in this file. After configuration start Elasticsearch.

Now elastic is started, You will see logs on your screen, From that logs you should find log includes transport address, Like below:

[2017-09-14 16:46:02,966][INFO ][transport] [Strong Guy] publish_address {192.168.xxx.xxx:9300}, bound_addresses {192.168.xxx.xxx:9300}

 

We need transport address in our portal so it will find Elasticsearch on network.

Step 5: Configure liferay portal to connect with Elastic cluster:

We are configuring liferay portal. Start liferay portal if you haven’t start.

  • Log in and click on control panel.
  • Configuration.
  • System settings.

  • Foundation.
  • Search for “Elasticsearch” in the list.

 

  • Click on Elasticsearch from result. Here are options you need to change:
  • Cluster name: set cluster name as you given in elasticsearch.yml config file.
  • Operation Mode: Default is EMBEDDED set to REMOTE.

4.png

 

  • Transport Addresses: Set transport address which we get from Elasticsearch logs.

5.png

 

  • Click on update.

Step 6: Restart liferay portal and reindex:

Restart liferay server. Once it running log in as administrative user.

  • Click on control panel
  • Configuration
  • Server Administration
  • Click on Execute button for Reindex all search indexes

6.png

 

When you click on execute button you will see some logs scroll up in your Elasticsearch log window.

You have done external Elasticsearch server Congratulation.

Comments
No comments yet. Be the first.

Contact Us

For your business requirements

Loading

Get in touch

Headquarter : 302, Landmark, Nr. Titanium City Center, Prahlad Nagar Road, Ahmedabad, India - 380015.

Showing 1 - 5 of 20 results.
of 4
contact-us Request a callback