Using Elasticsearch with Magento
Elasticsearch is a powerful search engine that improves product search speed and accuracy in Magento. It replaces the default MySQL search with a scalable, full‑text search solution. On ruachost.com, Elasticsearch is supported for Magento 2.4 and later.
Why Use Elasticsearch?
Section titled “Why Use Elasticsearch?”- Provides fast, relevant search results for customers.
- Supports advanced features like autocomplete, synonyms, and spell correction.
- Scales easily for large catalogs with thousands of products.
- Improves overall site performance compared to MySQL search.
Steps to Configure Magento with Elasticsearch
Section titled “Steps to Configure Magento with Elasticsearch”Step 1: Ensure Elasticsearch is Installed
Section titled “Step 1: Ensure Elasticsearch is Installed”-
On Managed VPS/Dedicated Servers → Ruachost support can install Elasticsearch for you.
-
On Unmanaged VPS → Install manually via SSH:
Terminal window apt-get install elasticsearchor
Terminal window yum install elasticsearch
Step 2: Configure Magento to Use Elasticsearch
Section titled “Step 2: Configure Magento to Use Elasticsearch”-
Log in to Magento Admin.
-
Go to Stores → Configuration → Catalog → Catalog Search.
-
Under Search Engine, select Elasticsearch.
-
Configure the following settings:
- Elasticsearch Server Hostname →
127.0.0.1(or your server’s IP). - Elasticsearch Server Port →
9200. - Index Prefix → Optional, useful for multiple Magento installations.
- Enable Elasticsearch HTTP Auth → Yes/No depending on your setup.
- Elasticsearch Server Timeout → Recommended:
15.
- Elasticsearch Server Hostname →
-
Save configuration.
Step 3: Test Elasticsearch Integration
Section titled “Step 3: Test Elasticsearch Integration”-
Run reindexing via CLI:
Terminal window php bin/magento indexer:reindex -
Clear cache:
Terminal window php bin/magento cache:flush -
Test product search in your storefront.
Important Notes
Section titled “Important Notes”- Elasticsearch is required for Magento 2.4 and newer.
- Ensure your server meets memory requirements (at least 2GB RAM for Elasticsearch).
- If using multiple stores, configure separate index prefixes.
- Always back up your site before making configuration changes.