Elasticsearch is an open source, highly scalable, full-text search and analytics engine.
By default, Elasticsearch runs as an embedded search engine, which is useful for development and testing but is not supported in production. In production environments you must run Elasticsearch in remote mode, as a separate server or cluster. This guide walks you through the process of configuring Elasticsearch in remote mode.
If you’d rather use Solr, it’s also supported. See the documentation on Installing Solr if you’re interested.
To get up and running quickly with Elasticsearch as a remote server, refer to the Installing Elasticsearch article. Those are basic instructions for installing and configuring Elasticsearch in a single server environment. This article includes more details and information on clustering and tuning Elasticsearch. Here, you’ll learn to configure your existing Elasticsearch installation for use in production environments.
If you’ve come here looking for information on search engines in general, or the low level search infrastructure of Liferay DXP, refer instead to the developer tutorial Introduction to Liferay Search (not yet written).
These terms are useful to understand as you read this guide:
Elasticsearch Home refers to the root folder of your unzipped Elasticsearch installation (for example,
Liferay Home refers to the root folder of your Liferay DXP installation. It contains the
licensefolders, among others.
Embedded vs. Remote Operation Mode
When you start Liferay DXP, this message is displayed in the log:
2018-12-10 16:20:32.987 WARN [Elasticsearch initialization thread][EmbeddedElasticsearchConnection:288] Liferay is configured to use embedded Elasticsearch as its search engine. Do NOT use embedded Elasticsearch in production. Embedded Elasticsearch is useful for development and demonstration purposes. Refer to the documentation for details on the limitations of embedded Elasticsearch. Remote Elasticsearch connections can be configured in the Control Panel.
When you install Liferay DXP, Elasticsearch is already embedded. In embedded mode, Elasticsearch search runs in the same JVM to make it easy to test-drive with minimal configuration. Running both servers in the same process has drawbacks:
- Elasticsearch must use the same JVM options as Liferay DXP.
- Liferay DXP and Elasticsearch compete for resources.
You wouldn’t run an embedded database like HSQL in production, and you shouldn’t run Elasticsearch in embedded mode in production either. Instead, run Elasticsearch in remote operation mode, as a standalone server or cluster of server nodes.
Sometimes things don’t go as planned. If you’ve set up Liferay DXP with Elasticsearch in remote mode, but Liferay DXP can’t connect to Elasticsearch, check these things:
- Cluster name:
- The value of the
cluster.nameproperty in Elasticsearch must match the
clusterNameproperty you configured for Liferay’s Elasticsearch adapter.
- Transport address:
- The value of the
transportAddressproperty in the Elasticsearch adapter must match the port where Elasticsearch is running. If Liferay DXP is running in embedded mode, and you start a standalone Elasticsearch node or cluster, it detects that port
9300is taken and switches to port
9301. If you then set Liferay’s Elasticsearch adapter to remote mode, it continues to look for Elasticsearch at the default port (
The following articles cover the Liferay Connector to Elasticsearch’s configuration options in more detail.