You have to maintain an active subscription in order to be able to use the repository!
ElasticSearch and Magento 2.
ElasticSearch in Magento 2 is not only about search, as the name implies.
It actually speeds up the display of things throughout Magento, e.g. anywhere you browse the catalog, like category pages.
So, for a supporting Magento version, and, if you have adequate RAM available, installing and using ElasticSearch for Magento 2, is a must.
In this short tutorial, I review simple steps on how to set up ElasticSearch in a single-server scenario, on CentOS/RHEL 7 and CentOS/RHEL 8.
Installing ElasticSearch package
The latest Magento, at the time of this writing, supports only ElasticSearch 7.x series, so this is what we are going to install:
First, create repo configuration at
[elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md
Magento 2 docs recommend specifically 7.6.x as being compatible. To install it, run:
sudo yum install --enablerepo=elasticsearch elasticsearch-7.6.*
Alternatively, if you feel lucky, you can try the most recent 7.x:
sudo yum install --enablerepo=elasticsearch elasticsearch
Enable ElasticSearch service by simply running:
sudo systemctl enable --now elasticsearch
Verify it’s running:
curl -XGET 'localhost:9200/_cat/health?v&pretty'
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent 1601396097 16:14:57 elasticsearch yellow 1 1 3 3 0 0 3 0 - 50.0%
Configure Elasticsearch within Magento
To configure Magento to use Elasticsearch:
- Log in to the Magento Admin as an administrator.
- Click Stores > Settings > Configuration > Catalog > Catalog > Catalog Search.
- From the Search Engine list, select your Elasticsearch version.
Now, reindex everything:
If you want to reset ElasticSearch indexes, here’s a handy command:
curl -X DELETE 'http://localhost:9200/_all'