layout | group | subgroup | title | menu_title | menu_order | menu_node | version | github_link |
---|---|---|---|---|---|---|---|---|
default |
config-guide |
14_Elastic |
Install and configure Elasticsearch |
Install and configure Elasticsearch (Enterprise Edition only) |
1 |
parent |
2.1 |
config-guide/elasticsearch/es-overview.md |
- Overview of Elasticsearch
- Install prerequisites and Elasticsearch
- Additional resources
- Configure nginx and Elasticsearch
- Configure Apache and Elasticsearch
- Configure Elasticsearch stopwords
-
Elasticsearch performs quick and advanced searches on products in the catalog
-
Elasticsearch analyzers support multiple languages
-
Supports stop words and synonyms
-
Indexing does not impact customers until reindex is completed
Elasticsearch returns search results based on the last generated index until the new one has been completely indexed so there's no disruption to customers
-
Accurate, performant, scalable
-
Works well out of the box
-
Easy to horizontally scale
-
Supports real-time data and analysis
-
Can be used as a document-oriented data store
-
Applications in framework beyond search—reporting, personalization, performance, and storage
Magento Enterprise Edition (EE) version 2.1.x supports the following Elasticsearch versions:
- If you get the Elasticsearch software from the Elasticsearch Linux repository, we support versions 2.x.
- If you get the Elasticsearch software from their Elasticsearch-PHP repository{:target="_blank"}, we support the
2.0
branch.
The following figure shows our recommended configuration. All of the tasks we discuss assume you've configured your system this way.
The preceding diagram shows:
-
The Magento application and Elasticsearch are installed on different hosts.
Running on separate hosts is secure, enables Elasticsearch to be scaled, and is necessary for proxying to work. (Clustering Elasticsearch is beyond the scope of this guide but you can find more information in the Elasticsearch documentation{:target="_blank"}.)
-
Each host has its own web server; the web servers don't have to be the same.
For example, the Magento application can run Apache and Elasticsearch can run nginx.
-
Both web servers use Transport Layer Security (TLS).
Setting up TLS is beyond the scope of our documentation.
Search requests are processed as follows:
-
A search request from a user is received by the Magento web server, which forwards it to the Elasticsearch server.
You configure Elasticsearch in the Magento Admin to connect to the proxy's host and port. We recommend the web server's SSL port (by default, 443).
-
The Elasticsearch web server (listening on port 443) proxies the request to the Elasticsearch server (by default, it listens on port 9200).
-
Access to Elasticsearch is further protected by HTTP Basic authentication.
For any request to reach Elasticsearch, it must travel over SSL and provide a valid user name and password.
-
Elasticsearch processes the search request.
-
Communication returns along the same route, with the Elasticsearch web server acting as a secure reverse proxy.
The tasks discussed in this section require the following:
{% include config/solr-elastic-selinux.md %}
{% include config/install-java.md %}
This section discusses how to install the latest 2.x version of Elasticsearch from their repository.
To install older versions, see the Elasticsearch reference{:target="_blank"} (for example, the 2.0 reference{:target="_blank"}).
To install Elasticsearch:
-
Log in to your Magento server as a user with
root
privileges. -
Enter the following commands in the order shown:
-
CentOS:
rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch vim /etc/yum.repos.d/Elasticsearch.repo
Add the following:
[elasticsearch-2.x] name=Elasticsearch repository for 2.x packages baseurl=http://packages.elastic.co/elasticsearch/2.x/centos gpgcheck=1 gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch enabled=1
Enter the following commands:
yum -y install elasticsearch chkconfig --add elasticsearch
-
Ubuntu:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list sudo apt-get -y update && sudo apt-get -y install elasticsearch
-
-
Open the Elasticsearch configuration file{:target="_blank"},
elasticsearch.yml
, in a text editor.For example, it might be located in
/etc/elasticsearch
. -
Add the following parameter to the
Memory
section:-
Very large catalogs (40,000 SKUs or more)
index.query.bool.max_clause_count: 10024
-
Catalogs with less than 40,000 SKUs:
index.query.bool.max_clause_count: 4096
For more information, see Setting the BooleanQuery maxClauseCount in Elasticsearch{:target="_blank"}.
-
-
Save your changes to
elasticsearch.yml
and exit the text editor. -
Optionally configure the Elasticsearch service.
-
Start Elasticsearch:
service elasticsearch start
-
Verify that Elasticsearch is working by entering the following command on the server on which it's running:
curl -i http://127.0.0.1:9200/_cluster/health
Messages similar to the following display if Elasticsearch is running:
{"cluster_name":"elasticsearch","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":100.0}
For additional information, see Elasticsearch documentation{:target=_"blank"}