Installing a Search Engine
A search engine is a critical component of your Liferay installation. Creating an Example Cluster can get you started with the installation, but this guide demonstrates setting up a production environment.
When you start Liferay, a built-in Elasticsearch server (sidecar) starts simultaneously. This default search engine provides search capabilities as a convenience for testing, but it isn’t supported for use in production. Getting Started with Elasticsearch describes production-level Elasticsearch setup. Using the Sidecar or Embedded Elasticsearch describes the default Elasticsearch server (sidecar in 7.3 and embedded in 7.2) features and limitations.
Liferay’s Solr support will receive one more update (to support Solr 8) before being deprecated. Though it can still be used, Solr is not bundled with Liferay and must be connected remotely, even for development and testing. To use Solr, see Installing Solr.
Java Requirements
-
Search engines require the environment variable
JAVA_HOME
orES_JAVA_HOME
(Elasticsearch 8). Set it on your search engine host. -
If you’re using Liferay 7.2, Elasticsearch and Liferay must use the same Java version and distribution. Consult the Elasticsearch compatibility matrix and Liferay’s Search Engine Compatibility Matrix to learn more about supported JDK distributions and versions. You can specify this in Elasticsearch:
[Elasticsearch Home]/bin/elasticsearch.in.sh`: `JAVA_HOME=/path/to/java`
The Java version and distribution requirement doesn’t apply to Liferay 7.3+ because the Elasticsearch 7 connector communicates via HTTP; there’s no JVM level serialization. See Elastic’s High-Level REST Client documentation for details.
The same requirement doesn’t apply to Solr either because the Solr connector also communicates via HTTP.
Clustering the Search Engine
A production environment’s search engine should be clustered for load management and optimal performance. Both Elasticsearch and Solr can be configured on multiple nodes in the remote environment.
-
To configure a remote Elasticsearch server or cluster, see Getting Started with Elasticsearch.
-
To configure a remote Solr server or cluster, see Installing Solr.
Selecting a Search Engine Vendor and Version
Elasticsearch is the recommended search engine for search and indexing with Liferay. Solr is planned for deprecation and has limitations.
Always refer to the Search Engine Compatibility Matrix to find the exact versions supported.
What’s Next
Installing Elasticsearch is recommended. If you must use Solr (deprecated), see Installing Solr.