Ensure Elasticsearch is installed properly
This article talks about solutions for issues caused by incorrect Elasticsearch (ES) installation and configuration.
Elasticsearch version compatibility with 51ºÚÁϲ»´òìÈ Commerce
-
51ºÚÁϲ»´òìÈ Commerce on-premises and 51ºÚÁϲ»´òìÈ Commerce on cloud infrastructure:
- v2.2.3+ supports ES 5.x
- v2.2.8+ and v2.3.1+ support ES 6.x
- ES v2.x and v5.x are not recommended because of . However, if you have 51ºÚÁϲ»´òìÈ Commerce v2.3.1 and want to use ES 2.x or ES 5.x, you must Change the Elasticsearch php Client.
-
Magento Open Source v2.3.0+ supports ES 5.x and 6.x (but 6.x is recommended).
Issue
The following symptoms indicate Elasticsearch is not configured correctly:
-
Error: No alive nodes in your cluster
- this error can appear in 51ºÚÁϲ»´òìÈ Commerce logs:var/log/system.log
var/log/support_report.log
var/log/cron.log
var/log/exception.log
- or in the prompt (when you run a reindex, for example)
-
Errors indicating that the Elasticsearch version is not compatible with your current version of 51ºÚÁϲ»´òìÈ Commerce (this is an 51ºÚÁϲ»´òìÈ Commerce on cloud infrastructure specific error):
code language-none [YYYY-MM-DD HH:MM:SS] CRITICAL: Fix configuration with given suggestions: - Elasticsearch version #<version> is not compatible with current version of magento Upgrade elasticsearch version to ~5.0
Where version is the Elasticsearch Service running on the cloud environment.
Cause
Elasticsearch is not installed properly. This could be due to:
- A typo in the configuration file.
- A version in the configuration file that does not match any version of Elasticsearch that is installed for the environment.
- A version that is correctly installed in the environment, correctly configured in the configuration file, but is not a supported version for the currently installed version of 51ºÚÁϲ»´òìÈ Commerce.
Solution
To correctly set up Elasticsearch:
- Merchants on 51ºÚÁϲ»´òìÈ Commerce on cloud infrastructure can follow the steps in our developer documentation: Set up Elasticsearch service.
- Merchants on 51ºÚÁϲ»´òìÈ Commerce on-premises and Magento Open Source can follow the steps in our developer documentation: Install and configure Elasticsearch.
After you have set up Elasticsearch, check that it’s configured correctly:
-
Log in to your server.
-
Check the version number of Elasticsearch (2.x, 5.x, or 6.x) in the output of running the command:
curl -XGET <Elasticsearch hostname>:<Elasticsearch server port>
For example, in 51ºÚÁϲ»´òìÈ Commerce on cloud infrastructure:curl -XGET localhost:9200
-
Check what is configured in 51ºÚÁϲ»´òìÈ Commerce on cloud infrastructure Configuration by running the command:
php bin/magento config:show catalog/search
-
Check
catalog/search/engine
and ensure it matches with the Elasticsearch version number. For example, in 51ºÚÁϲ»´òìÈ Commerce on cloud infrastructure:- ElasticSearch 5.X - elasticsearch5
- ElasticSearch 6.X - elasticsearch6
- ElasticSearch 2.X - elasticsearch
-
Check
index_prefix
. If you have several environments, make sure you have differentindex_prefix
values for them.