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
- Environment - Elastic Stack 6.8.x
- Resolution - Elastic Stack 6.8.x
- Configuring Monitoring
- Elastic Cloud Restrictions
- Cloud Provider Restrictions
Environment - Elastic Stack 7.x
- Liferay DXP 7.3 GA1* + Elasticsearch 7.10.0**
- Liferay DXP 7.2 (FP8/SP3)* + Liferay Connector to Elasticsearch 7 (v3.1.0)* + Elasticsearch 7.9.0**
Resolution - Elastic Stack 7.x
- Pre: Make sure that the four required analyzer plugins (analysis-icu, analysis-kuromoji, analysis-smartcn and analysis-stempel) are configured on the deployment customization screen
- 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
-
- Save the deployment credentials that Elastic Cloud provides you at the end of the deployment creation process.
- username: elastic
- password: <password>
- Copy the Endpoint of your Elasticsearch Service from the overview page of your deployment. This will look similar to this:
-
https://5b8cfb0167c54ab4afb1bbd157471f77.us-west1.gcp.cloud.es.io:9243
- 5b8cfb0167c54ab4afb1bbd157471f77 is the name of your cluster
- 9243 is the HTTP port, you will need this on DXP 7.3. On DXP 7.2, you will need to use 9343 for the Transport port in the configuration below!
-
- Stop Liferay DXP
- Download and import the certificate of your Elasticsearch Deployment
- Download the server's certificate in PEM format (for example through your browser's HTTPS connection inspection tool or using openssl):
openssl s_client -connect 5b8cfb0167c54ab4afb1bbd157471f77.us-west1.gcp.cloud.es.io:9243 -showcerts
- The base-64 encoded text for your server
gcp.cloud.es.io
(between the “-----BEGIN CERTIFICATE-----“ and the “-----END CERTIFICATE -----“) is the certificate of interest.
- Copy the certificate text into a file called server.pem
- Import the server's certificate into your client's (Liferay DXP) PKCS# 12 format trust store (elastic-certificates.p12, assuming you have created this already):
keytool -importcert -keystore elastic-certificates.p12 -storepass <password> -alias <preferred-alias> -file server.pem
- Download the server's certificate in PEM format (for example through your browser's HTTPS connection inspection tool or using openssl):
- Create
com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config
in[Liferay-Home]/osgi/configs
with the following content:- DXP 7.3:
-
clusterName="5b8cfb0167c54ab4afb1bbd157471f77"
networkHostAddresses=["https://5b8cfb0167c54ab4afb1bbd157471f77.us-west1.gcp.cloud.es.io:9243"]
operationMode="REMOTE"
productionModeEnabled=B"true"
username="elastic"
password="<password>"
authenticationEnabled=B"true"
httpSSLEnabled=B"true"
truststorePassword="liferay"
truststorePath="/PATH/TO/elastic-certificates.p12"
truststoreType="pkcs12" - clusterName: Comes from your Elasticsearch Endpoint.
- networkHostAddresses: This single transport address (which you can derive from your Elasticsearch Endpoint) is the only one you need to set in the connector configuration.
- See also the Security related restrictions of Elastic Cloud
-
- DXP 7.2:
-
clusterName="5b8cfb0167c54ab4afb1bbd157471f77"
clientTransportSniff=B"false"
operationMode="REMOTE"
transportAddresses=["5b8cfb0167c54ab4afb1bbd157471f77.us-west1.gcp.cloud.es.io:9343"] - clusterName: Comes from your Elasticsearch Endpoint.
- clientTransportSniff: Sniffing must be disabled (ref.)
- transportAddresses: This single transport address (which you can derive from your Elasticsearch 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!
-
- DXP 7.3:
- (On DXP 7.2 only) 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="certificate"
sslKeyPath=""
sslCertificatePath=""
sslCertificateAuthoritiesPaths=[]
certificateFormat="pkcs12"
sslKeystorePath="/PATH/TO/elastic-certificates.p12"
sslKeystorePassword="liferay"
sslTruststorePath="/PATH/TO/elastic-certificates.p12"
sslTruststorePassword="liferay" - See also the Security related restrictions of Elastic Cloud
-
- (On DXP 7.2 only) If the Connector to Elasticsearch 7 was not deployed previously, download and the put the LPKG file into
[Liferay-Home]/osgi/marketplace.
- Start Liferay DXP
- Go to the Search admin in the Control Panel and check the connection information (on DXP 7.1+). 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.9.0), instance-0000000000 (7.9.0), tiebreaker-0000000002 (7.9.0)]
-
- Perform a full reindex and also reindex the spell-check indexes.
Environment - Elastic Stack 6.8.x
- Liferay DXP 7.0-7.2 (DXP 7.2 SP2)*
- Liferay Connector to Elasticsearch 6 (v1.1.0, for DXP 7.0 only)
- Liferay Enterprise Search Security (requires Liferay Enterprise Search subscription!)
- Elasticsearch 6.8.10**
Resolution - Elastic Stack 6.8.x
- Pre: Make sure that the four required analyzer plugins (analysis-icu, analysis-kuromoji, analysis-smartcn and analysis-stempel) are configured on the deployment customization screen
- 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
-
- Save the deployment credentials that Elastic Cloud provides you at the end of the deployment creation process.
- username: elastic
- password: <password>
- Copy the Deployment Endpoint of your Elasticsearch Service from the overview page of your deployment. This will look similar to this:
-
https://5b8cfb0167c54ab4afb1bbd157471f77.us-west1.gcp.cloud.es.io:9243
- 5b8cfb0167c54ab4afb1bbd157471f77 is the name of your cluster
- 9243 is the HTTP port. You will need to use 9343 for the Transport port in the configuration below!
-
- Stop Liferay DXP
- 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 Elasticsearch 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!
-
- 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="certificate"
sslKeyPath=""
sslCertificatePath=""
sslCertificateAuthoritiesPaths=[]
certificateFormat="pkcs12"
sslKeystorePath="/PATH/TO/elastic-certificates.p12"
sslKeystorePassword="liferay"
sslTruststorePath="/PATH/TO/elastic-certificates.p12"
sslTruststorePassword="liferay" - See also the Security related restrictions of Elastic Cloud
-
- If Liferay Enterprise Search Security was not deployed previously, download and the put the LPKG file into
[Liferay-Home]/osgi/marketplace.
- Start Liferay DXP
- 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)]
-
- Perform a full reindex and also reindex the spell-check indexes.
Configuring Enterprise Search Monitoring/X-Pack Monitoring
Configuring Liferay Enterprise Search Monitoring 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:
- https://www.elastic.co/guide/en/cloud/current/ec-billing-aws.html
- https://www.elastic.co/guide/en/cloud/current/ec-billing-gcp.html
- https://www.elastic.co/guide/en/cloud/current/ec-billing-azure.html
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.