yumupgrades for production use, this is the repository for you.
Active subscription is required.
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 the ElasticSearch 7.x series, so this is what we are going to install.
Magento 2.4 docs recommend specifically 7.9.x as being compatible. To install it, run:
sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm sudo yum -y install 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'