How To Configure Elasticsearch in Magento 2

The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

Elasticsearch is a robust and highly scalable catalog search solution which is used by high-volume sites such as eBay, Wikipedia, and GitHub. With the support of Magento 2 Elasticsearch, store admins can implement both search suggestions and recommendations, giving a better customer experience to make extra sales.

In this article, you will be instructed to configure Elasticsearch in Magento 2.

Tip: Download Elasticsearch by Mageplaza to enable any search, auto-corrected spelling, synonym searches, behaviour tracking, and more.

Discover the comparison between Sphinx Search and Elasticsearch here

3 steps to configure Elasticsearch in Magento 2:

Step 1: Configure Search Options

  1. From the Admin sidebar, select Stores. Then under Settings, select Configuration.

Configure Search Options

  1. In the panel on the left of the screen, under CATALOG, select Catalog.

Configure Search Options 2

  1. Click on Catalog Search to expand this section.

Configure Search Options 3

  1. In the Search Engine field, clear the Use system value checkbox and select the version of Elasticsearch that is installed on your server.

Configure Search Options 4

  • Elaticsearch (Deprecated) Elasticsearch 2.0+ has reached the end of life and is considered inactive development or maintenance.
  • Elaticsearch 5.0+ (Default) Elasticsearch 5.0+ is planned for the end of life.
  • Elasticsearch 6.0+ (Recommended) For the best performance, we highly recommend that you use the latest version of Elasticsearch 6.0+.
  1. In the Enable EAV Indexer field, select the Yes/ No option to enable/ disable the Product EAV indexer. This functionality increases indexation speed and keeps the indexer from being used by 3rd party extensions. This feature does not display the system value Search Engines.

  2. To restrict the length and word count of search query text, set the Minimal Query Length and Maximum Query Length.

Note: The value set for this minimum and maximum range must be compatible with the corresponding range set in your Elasticsearch search engine configurations. For example, if you set these values to 2 and 300 in Magento, update the values in your search engine.

  1. To restrict the number of popular search results to cache for faster responses, enter a number on the Number of top search results to the cache field.

  2. To restrict the maximum number of search results to show for search autocomplete, set an amount for Autocomplete Limit. Limiting this amount enhances the performance of searches and cuts down the displayed list size. The default number is 8.

Step 2: Configure the Elasticsearch Connection

Configure the Elasticsearch Connection

  1. Enter the Elasticsearch Server Hostname. The default is localhost
  2. Enter the Elasticsearch Server Port.
  3. Enter a prefix in the Elasticsearch Index Prefix field to determine the Elasticsearch index. For instance: Magento2.
  4. In the Enable Elasticsearch HTTP Auth field, select the Yes option to use HTTP authentication to suggest a username and password access Elasticsearch Server.
  5. Enter the number of seconds before the system times out to the Elasticsearch Server Timeout field. The default number is 15.
  6. To verify the configuration, click the Test Connection button.

Step 3: Configure Suggestions and Recommendations

Search suggestions and recommendations can affect server performance

  1. In the Enable Search Suggestions field, choose the Yes option. Then, take the following actions:

Configure Suggestions and Recommendations 1

  • Fill the Search Suggestions Count field with the number of search suggestions to offer.
  • In the Show Results for Each Suggestion field, select the Yes option to display the number of results found for each suggestion.
  1. In the Enable Search Recommendations field, select Yes option to offer recommendations.
    • Fill the Search Recommendation Count field with the number of recommendations to offer.
    • In the Show Results Count for Each Recommendation field, select Yes to display the number of results found for each recommendation.
  2. When you finish your configuration, click on the Save Config button.

Ajax Search

Search Extension for Magento 2

AJAX & Auto-complete search for up to 10,000 SKUs

Check it out!


The detailed instructions above hopefully gives you ideas on how to configure Elasticsearch in Magento 2. If you have questions on any steps, don’t hesitate to contact us. And if you would you like to provide all advanced techniques for searching online in your store, let the Ajax Search extension help you! Ajax Search for Magento 2 is the perfect solution to make your website more optimized and flexible in searching for products as well as enhance customer satisfaction and boost your online store sale.

Get Magento 2 Elasticseach extension FREE!

Looking for
Customization & Development Services?

8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.

Get free consultant
development service
  • elasticsearch

Image Description
Sam Thomas
Sam is the CEO and Founder of Mageplaza, pursuing a simple and healthy lifestyle. He is a friend, a husband, and a father to two children. As a trainer and an aspiring influencer, he is also a big fan of sports and travel. Sam is exceptionally knowledgeable about e-commerce, especially Magento and Shopify, with 10 years of experience in the field.

Explore Our Products:

People also searched for


Stay in the know

Get special offers on the latest news from Mageplaza.

Earn $10 in reward now!

Earn $10 in reward now!

go up