Reading Time: 2 minutes

How to setup Elasticsearch in Magento 2?

In this article, we will look at the Elasticsearch configurations in Magento 2. But before we get started, make sure you have installed the Elasticsearch engine on your server.

For this, check the official installation guide or ask our specialists about the installation service.

→ Expand your search possibilities with our elastic search plugin. It includes autocomplete suggestions, spell correction, long tail search, fallback search, and other features to make your store search even faster.

Step 1. Log into your admin panel and go to Stores> Settings> Configuration.

Step 2. Then, on the Catalog tab, click Catalog and open the Catalog Search section.

Step 3. In the Search Engine field, choose the version of Elasticsearch installed on your server. Magento recommends using versions 5.x and later.


Step 4. If necessary, you can enable EAV Indexer to improve the indexing speed of your Magento 2.

Step 5. Next, specify the minimum and maximum length of the query. Keep in mind that these numbers should be the same as the search engine configurations.

Step 6. Define the number of top search results to cache and the auto-complete limit. These settings can affect search performance.

Step 7. Next, you need to set up the connection.



For this, enter Elasticsearch Server Hostname, Port and Index Prefix.


Step 8. If necessary, enable Elasticsearch HTTP authentication.

Step 9. In the Elasticsearch Server Timeout field, enter the number in seconds. Then click Test Connection. If you get the error and the test failed, check the official documentation to fix the problem.

Step 10. Finally, configure the search suggestions.



Under Search Suggestions Count, specify how many search suggestions you want to see.

Step 11. In the Show results for each suggestion field, you can set whether you want to display the total number of search results.

Step 12. Enable search suggestions, then enter the search suggestion count and set if you want to display the result count for each recommendation.

Step 13. Save the changes.


Free 30-days trial Hosting Fast, Secure and Optimized

Switch to Bhoost with 30 days free and migration included

Free 30-days trial