How to configure Liferay DXP to connect to Elasticsearch on Elastic Cloud

This article shows an example configuration only and assumes a familiarity with configuring Liferay DXP with Elasticsearch in a local/on-premise deployment.

Table of Contents

Environment - Elastic Stack 7.x

Resolution - Elastic Stack 7.x

  1. If you are using DXP 7.2, add the following property to elasticsearch.yml under the User settings overrides section on the Edit screen of your deployment:
    • cluster.indices.close.enable: true
  2. Save the deployment credentials that Elastic Cloud provides you at the end of the deployment creation process.
    • username: elastic
    • password: <password>
  3. Copy the Deployment Endpoint of your Elasticsearch Service from the overview page of your deployment. This will look similar to this:
  4. Stop Liferay DXP
  5. Create com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config in [Liferay-Home]/osgi/configs with the following content:
    • clusterName="5b8cfb0167c54ab4afb1bbd157471f77"
      clientTransportSniff=B"false"
      operationMode="REMOTE"
      transportAddresses=["5b8cfb0167c54ab4afb1bbd157471f77.us-west1.gcp.cloud.es.io:9343"]
    • clusterName: Comes from your Deployment Endpoint.
    • clientTransportSniff: Sniffing must be disabled (ref.)
    • transportAddresses: This single transport address (which you can derive from your Deployment Endpoint) is the only one you need to set in the connector configuration. "Deployments hosted on Elasticsearch Service are behind proxies which prevent the transport client from communicating directly with Elasticsearch clusters" (ref.). Remember to use 9343!
  6. Create com.liferay.portal.search.elasticsearch7.configuration.XPackSecurityConfiguration.config in [Liferay-Home]/osgi/configs with the following content:
    • requiresAuthentication=B"true"
      username="elastic"
      password="<password>"
      transportSSLEnabled=B"true"
      transportSSLVerificationMode="none"
      sslKeyPath=""
      sslCertificatePath=""
      sslCertificateAuthoritiesPaths=[]
      certificateFormat="PEM"
    • transportSSLVerificationMode is set to "none", because we don't set the server's CA. If you want to use "certificate" or "full" verification mode you need to download the cert of the server's CA and add its path to the "sslCertificateAuthoritiesPaths" property in your config file.
    • See also the Security related restrictions of Elastic Cloud
  7. If the Connector to Elasticsearch 7 was not deployed previously, download and the put the LPKG file into [Liferay-Home]/osgi/marketplace.
  8. Start Liferay DXP
  9. Go to the Search admin in the Control Panel and check the connection information (on DXP 7.1 and DXP 7.2). You will see something like this if everything is working properly:
    • Search Engine Vendor: Elasticsearch, Client Version: 7.3.0, Nodes: 5b8cfb0167c54ab4afb1bbd157471f77: [instance-0000000001 (7.7.1), instance-0000000000 (7.7.1), tiebreaker-0000000002 (7.7.1)]
  10. Perform a full reindex and also reindex the spell-check indexes.

Environment - Elastic Stack 6.8.x

Resolution - Elastic Stack 6.8.x

  1. If you are using DXP 7.2, add the following property to elasticsearch.yml under the User settings overrides section on the Edit screen of your deployment:
    • cluster.indices.close.enable: true
  2. Save the deployment credentials that Elastic Cloud provides you at the end of the deployment creation process.
    • username: elastic
    • password: <password>
  3. Copy the Deployment Endpoint of your Elasticsearch Service from the overview page of your deployment. This will look similar to this:
  4. Stop Liferay DXP
  5. Create com.liferay.portal.search.elasticsearch6.configuration.ElasticsearchConfiguration.config in [Liferay-Home]/osgi/configs with the following content:
    • clusterName="5b8cfb0167c54ab4afb1bbd157471f77"
      operationMode="REMOTE"
      transportAddresses=["5b8cfb0167c54ab4afb1bbd157471f77.us-west1.gcp.cloud.es.io:9343"]
      clientTransportSniff=B"false"
    • clusterName: Comes from your Deployment Endpoint.
    • clientTransportSniff: Sniffing must be disabled (ref.)
    • transportAddresses: This single transport address (which you can derive from your Deployment Endpoint) is the only one you need to set in the connector configuration. "Deployments hosted on Elasticsearch Service are behind proxies which prevent the transport client from communicating directly with Elasticsearch clusters" (ref.). Remember to use 9343!
  6. Create com.liferay.portal.search.elasticsearch6.xpack.security.internal.configuration.XPackSecurityConfiguration.config in [Liferay-Home]/osgi/configs with the following content:
    • requiresAuthentication=B"true"
      username="elastic"
      password="<password>"
      transportSSLEnabled=B"true"
      transportSSLVerificationMode="none"
      sslKeyPath=""
      sslCertificatePath=""
      sslCertificateAuthoritiesPaths=[]
      certificateFormat="PEM"
    • transportSSLVerificationMode is set to "none", because we don't set the server's CA. If you want to use "certificate" or "full" verification mode you need to download the cert of the server's CA and add its path to the "sslCertificateAuthoritiesPaths" property in your config file.
    • See also the Security related restrictions of Elastic Cloud
  7. If the Connector to X-Pack Security was not deployed previously, download and the put the LPKG file into [Liferay-Home]/osgi/marketplace.
  8. Start Liferay DXP
  9. Go to the Search admin in the Control Panel and check the connection information (on DXP 7.1 and DXP 7.2). You will see something like this if everything is working properly:
    • Search Engine Vendor: Elasticsearch, Client Version: 6.8.6, Nodes: 5b8cfb0167c54ab4afb1bbd157471f77: [instance-0000000001 (6.8.10), instance-0000000000 (6.8.10), tiebreaker-0000000002 (6.8.10)]
  10. Perform a full reindex and also reindex the spell-check indexes.

Configuring X-Pack Monitoring

Configuring Liferay's X-Pack Monitoring connector to connect to your hosted Kibana is not possible as the Kibana Service does not support required user settings such as server.basePath and server.rewriteBasePath.

Elastic Cloud Restrictions

Not all features and configurations of Elasticsearch and Kibana are supported on Elastic Cloud. Please refer to the article below for details:

https://www.elastic.co/guide/en/cloud/current/ec-restrictions.html

Cloud Provider Restrictions

Depending on the cloud provider of your choice and your subscription method, additional restrictions may apply to your Elasticsearch Service deployments. Please refer to the following resources to learn about which features are impacted:


Please see this article for a technical overview of the Elasticsearch connectors available for Liferay DXP.

*  The patch level and Marketplace versions inside the brackets indicate the versions used to create this article. Please review the Compatibility Matrix for other compatible environments.

**  For this article, Elastic Cloud testing was conducted using Google Cloud Platform and the four required analyzer plugins (analysis-icu, analysis-kuromoji, analysis-smartcn and analysis-stempel) on the deployment customization screen.

Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0