Elasticsearch is the default search engine for Liferay Portal CE 7.1. The Liferay Foundation suite includes an adapter for Elasticsearch called Liferay Connector to Elasticsearch 6. The adapter is configurable through System Settings or an OSGi configuration file named
com.liferay.portal.search.elasticsearch6.configuration.ElasticsearchConfiguration.cfg and deployed to
The list below is all the configuration settings for Liferay’s default Elasticsearch adapter, in the order they appear in the System Settings application (The Elasticsearch 6 entry under the Search category):
- A String value that sets the name of the cluster to integrate with. This name should match the remote cluster when Operation Mode is set to remote. (See also: remote operation mode)
- There are two operation modes you can choose from: EMBEDDED or REMOTE. Set to REMOTE to connect to a remote standalone Elasticsearch cluster. Set to EMBEDDED to start Liferay with an internal Elasticsearch instance. Embedded operation mode is unsupported for production environments.
- Set a String value to use as the prefix for the search index name. The default value should not be changed under normal conditions. If you change it, you must also perform a reindex all operation for the portal and then manually delete the old index using the Elasticsearch administration console.
indexNumberOfReplicas= Set the number of replicas for each index. If left unset, no replicas are used. A full reindex is required to make changes take effect.
indexNumberOfShards= Set the number of index shards to use when a Liferay index is created. If left unset, a single shard is used. A full reindex is required to make changes take effect.
- A boolean setting that, when set to
true, tries to lock the process address space into RAM, preventing any Elasticsearch memory from being swapped out (see here) for more information)
- A boolean setting that, when set to true, only logs exceptions from Elasticsearch, and does not rethrow them.
- Set an int value for the number of retries to attempt if a version conflict occurs because the document was updated between getting it and updating it (see here for more information).
- Set a String value for the range of ports to use when building the value for discovery.zen.ping.unicast.hosts. Multiple Elasticsearch nodes on a range of ports can act as gossip routers at the same computer (see here for more information).
- Set this String value to instruct the node to bind to this hostname or IP address and publish (advertise) this host to other nodes in the cluster. This is a shortcut which sets the bind host and the publish host at the same time (see here for more information).
- Set the String value of the network interface(s) a node should bind to in order to listen for incoming requests (see here for more information).
- Set the String value of a single interface that the node advertises to other nodes in the cluster, so that those nodes can connect to it (see here for more information).
- Set the String value for the port to bind for communication between nodes. Accepts a single value or a range (see here for more information).
- Set the String values for the addresses of the remote Elasticsearch nodes to connect to. This value is required when Operation Mode is set to remote (see here for more information). Specify as many or few nodes as you see fit.
- Set this booleant to true to enable cluster sniffing and dynamically discover available data nodes in the cluster (see here for more information).
- Set this boolean to true to ignore cluster name validation of connected nodes (see here for more information).
clientTransportPingTimeout= The time (in seconds) the client node waits for a ping response from a node. If unset, the default Elasticsearch
client.transport.ping_timeout is used.
- Set this String value to instruct the client node on how often to sample / ping the nodes listed and connected (see here for more information).
- Set this boolean to false to disable the http layer entirely on nodes which are not meant to serve REST requests directly. As this setting was deprecated in Elasticsearch 6.3, the connector’s corresponding setting is now also deprecated. This setting was only used for configuring the embedded Elasticsearch server, so its deprecation should have minimal impact to production deployments.
- Set this boolean to false to disable cross-origin resource sharing, i.e. whether a browser on another origin can do requests to Elasticsearch. If disabled, web front end tools like elasticsearch-head may be unable to connect (see here for more information).
- Set the String origins to allow when HTTP CORS is enabled (see here for more information).
- Set the String values for custom settings for HTTP CORS, in YML format (elasticsearch.yml) (see here for more information).
- Set the String values for custom settings for embedded Elasticsearch, in YML format. See: Adding Settings to the Liferay Elasticsearch Adapter
- Set the String values for custom settings for the Liferay index, in JSON or YML format (refer to the Elasticsearch Create Index API for more information). See: Adding Settings to the Liferay Elasticsearch Adapter
- Set the String values for custom mappings for the
LiferayDocumentType, in JSON format (refer to the Elasticsearch Put Mapping API for more information) See: Adding Settings to the Liferay Elasticsearch Adapter
overrideTypeMappings= Settings here override Liferay Portal’s default type mappings. This is an advanced feature that should be used only if strictly necessary. If you set this value, the default mappings used to define the Liferay Document Type in Liferay Portal source code (for example,
liferay-type-mappings.json) are ignored entirely, so include the whole mappings definition in this property, not just the segment you’re modifying.
syncSearch=true If enabled, search runs on the invoker thread rather than in Elasticsearch’s search thread pool.
The following settings are only available in the Elasticsearch 6 adapter:
Configurations only Affecting the Embedded Elasticsearch Server
These settings (defined above) are only meant to use while configuring the embedded Elasticsearch server. Configuring these will elicit no effect on remote Elasticsearch installations:
You can easily configure these settings in the System Setting application, or as mentioned above, you can specify them in a deployable OSGi