Elasticsearch is an open source, highly scalable, full-text search and analytics engine.
By default, Elasticsearch runs as an embedded search engine, but it’s only supported in production 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. Included there are basic instructions for installing and configuring Elasticsearch in a single server environment. Additional articles include more details and information on configuring and tuning Elasticsearch.
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.
When you start Liferay DXP, this message is displayed in the log:
2019-04-29 09:59:02.276 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 start Liferay DXP, Elasticsearch is already running in embedded mode. Liferay DXP runs an Elasticsearch node in the same JVM so it’s 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 the same system 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
elasticsearch.ymlmust match the
clusterNameproperty configured in the Liferay DXP Elasticsearch connector.
- Transport address:
- The value of the
transportAddressesproperty in the Elasticsearch connector configuration must contain at least one valid host and port where an Elasticsearch node 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 connector 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.
- Cluster Sniffing (Additional Configurations):
- Elasticsearch clusters can have multiple node
enabled by default in the Liferay DXP connector, looks for
datanodes configured in the
transportAddressesproperty. If none are available, the connector may throw a
NoNodeAvailableExceptionin the console log. If cluster sniffing is to remain enabled, be sure that your configuration allows for at least one
datanode’s transport address to be “sniffable” at all times to avoid this error.
To disable cluster sniffing, add
clientTransportSniff=false to the
file or un-check the Client Transport Sniff property in System Settings.