This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How to Configure Magento 2 Elasticsearch

Updated on March 31, 2022

7 Min Read

Ecommerce platform developers are continuously working to introduce technologies and components that directly improve user experience, and Magento is no different. Magento 2 Elasticsearch is one such component that improves the user journey. It makes it easy for users to find the right product almost immediately, close the transaction within minutes and thus have a great shopping experience.

In this blog, we will cover how you can install and configure using Cloudways and Magento 2 admin panel.

What is Magento Elasticsearch?

Elasticsearch was introduced as a full-text search solution which not only suggests related keywords but also shows complete queries based on the query. However, Elasticsearch is not just limited to search queries. It can also be used to set up store-wide search capabilities.

Magento 2 Elasticsearch is a server-based tool that is capable of full-text search at a very high speed. Powered by Apache Lucene (an open-source full-text search library), it offers a fast web content search capability. The reason behind the fast response is the indexing service that is used for contextual search instead of searching the entire database for the match.

The search process is similar to the index of a book. Similar to a book index, the matching starts from the initial part of the query and the results are refined as the query is entered. So as soon as the user starts entering the search string, Elasticsearch starts producing matches.

While matching the search results, Magento Elasticsearch starts suggesting related products, along with images, price, ratings, and related information to narrow down the search results. The search filter and suggestions are based on the Magento 2 Elasticsearch configuration which I will discuss later in this article.

Benefits of Magento 2 Elasticsearch

According to Microsoft, the attention span of an average user has gone down to just 8 seconds. Given this, online retailers must be able to sell quickly within this window.

Another related fact is that the longer users spend on your site, the less likely it is that they will buy something. Think of it this way: Why would anyone stay in a store, if the salesperson keeps on showing things that you do not want?

Elasticsearch keeps your Magento store’s search functionality precise and fast for your potential customers. This enhances the customer’s experience and lets them make good use of their time in your store.

Some additional benefits of configuring Elasticsearch in Magento 2 store are:

  • Ease of displaying products and their attributes for all related search queries
  • Improve response times, especially when you have a large data volume
  • Improve conversion by displaying related information that helps make a better purchase decision

Elasticsearch on Magento 2 comes with a host of features such as:

  • Search optimization
  • Search autocomplete
  • Thesaurus management (synonyms, expansions)
  • Advanced price slider
  • Multi-select in layered navigation & swatches
  • Redirection to product page in case of single results
  • Auto spell check & stopwords detection
  • Customizable filters
  • Multiple languages supported
  • Real-time data and analysis

What are the Prerequisites for Setting Up Elasticsearch?

Now that you have understood the need for Elasticsearch, let’s look into the prerequisites for configuring the module for different Magento versions.

Magento Elasticsearch Requirement

According to the official Magento release,  Elasticsearch 2.x and early 5.x versions are outdated and you need to upgrade to a later version of 5.x. If you have the latest Magento version (2.4.x), you should opt for Elasticsearch 7.6.x.

In addition to a compatible Magento Elasticsearch version, you should also have:

Magento 1 EOL Is Coming Soon

Worried about your Magento 1 store security? Hunting for a reliable way to upgrade from M1 to M2?

We Got You Covered!

Configuring Server For Magento Elasticsearch

You can quickly set up Elasticsearch on your Magento store by following the process below. For the purpose of demonstrating the process, I will use my Cloudways managed Magento server. This means I have an active server on the Cloudways Platform with an active Magento app.

Let’s start.

Prepare Your Server on Cloudways

The best part of configuring Magento Elasticsearch with Cloudways is that you can install Elasticsearch in a few clicks without going to the CLI.

Let’s see how easily you can launch your Cloudways managed Magento server and install Elasticsearch.

  • Log in/sign up to the Cloudways Platform.

Cloudways platform sign up

  • Select Magento Application from the drop-down menu. Next, name your application and server.

Magento 2 Elasticsearch 1

  • Select the Cloud Provider of your choice from the available cloud infrastructure options.

Choose Cloud Providers for Magento application

  • Choose server size based on your needs. You can always scale the server whenever you realize that server resources are running low.

Select Server Size

  • Select a server location nearest to your audience. For each cloud provider, you have the option of multiple data centers.

Choose Nearest Server Location for Magento Application

Now click the Launch Now button and wait for a few minutes while the server and the application are set up.

Enable Elasticsearch

After successfully configuring the Cloudways managed server, you need to enable Elasticsearch on the server. For this, go to the Settings & Packages tab on the Server Management screen.

Magento 2 Elasticsearch 2

Elasticsearch is now enabled on your server.

Now let’s go over the Magento 2 Elasticsearch configuration process.

With Magento 2 latest version, Elasticsearch has become a default, greatly simplifying the configuration and store-level integration requirements.

I will now demonstrate the ease with which you can set up Elasticsearch with your Magento 2 store.

Configure Magento 2 Elasticsearch – The Step-by-Step Guide

Here’s the simple process of setting up Magento 2 Elasticsearch

  • Log in to the Magento Admin as an Administrator.
  • Click Stores > Settings > Configuration > Catalog > Catalog > Catalog Search

Magento 2 Elasticsearch 3

  • In Minimum Query Length, enter the query length at which Magento 2 Elasticsearch will get enabled.
  • In Maximum Query Length, enter the length of the query for which Magento 2 Elasticsearch would remain enabled.
  • In the Number of top search results to cache, enter the number of popular searches that the module should store for faster response.
  • Next, Enable EAV Indexer to Yes to improve indexation speed.
  •  Set the Search Engine to either Elasticsearch 5.0+, Elasticsearch 6.0+ or Elasticsearch 7 (Recommended). It is recommended to Use System Value because it automatically picks server packages for the configuration.
  • In Autocomplete Limit, enter the maximum limit for similar suggestions for each query.

catalog search 2 Magento Elasticsearch

  • In Elasticsearch Server Hostname, enter the fully qualified hostname or IP address of the server that is running the Magento 2 Elasticsearch.
  • In Elasticsearch Server Port, enter the Magento 2 Elasticsearch server proxy port. If ‘9200’ does not work for you, try ‘8080’. If you’re using a secure proxy, you can also use port ‘443’.
  • Elasticsearch Index Prefix: You can use the default prefix magento2 but if you use a single Elasticsearch instance for more than one Magento installation, you will have to specify a unique prefix for each installation. This is because Magento has a multi-store inventory feature, and if a single Elasticsearch is used for all stores, it would be difficult to distinguish between the stores.
  • To Enable Elasticsearch HTTP Auth, select Yes. Next, provide a username and password in the specified fields. It is recommended that you keep it to No.
  • In Elasticsearch Server Timeout, define the time after which your Magento 2 Elasticsearch server would time out. The time is in seconds.Magento 2 Elasticsearch 5
  • Enable Search Suggestions to Yes if you want to show suggestions in your Elasticsearch search space.
  • In Search Suggestions Count, define the count for search suggestions. On average, two suggestions are displayed with each search.
  • If Show Results Count for Each Suggestion is selected as Yes, the count for each suggestion would be displayed.
  • If you Enable Search Recommendations to Yes, recommendations will be displayed for search strings.
  • In Search Recommendations Count, define the count for search suggestions
  • If Show Results Count for Each Recommendation is selected as Yes, the count for results would be displayed with each suggestion.

Magento 2 Elasticsearch 6

Magento Elasticsearch Configuration FAQs

Q: What is Magento Elasticsearch?

A: Magento Elasticsearch is a store-level search engine that delivers store-wide search results so that visitors can quickly see the list of products they wish to buy. For store owners, Magento Elasticsearch is a fantastic tool for offering related products and deploying upsell and cross-sell tactics.

Q: How does Magento Elasticsearch work?

A: Magento Elasticsearch relies on several data sources including the logs and database. Once the data has been parsed, it is added to the Elasticsearch index. Now. storeowners can execute complex queries to take advantage of the indexed data to deliver precise information in response to the user-generated searches.

Q: Why is Magento 2 Elasticsearch fast?

A: Magento 2 Elasticsearch is significantly faster than traditional search engines because of the way it works. Instead of searching the raw data in response to user queries, Elasticsearch searches its index, a significantly faster process because the data in the index is normalized and optimized for the search process.

Q: Is Elasticsearch free?

A: Elasticsearch is absolutely free to use because it is free and open-source software..

Final Word!

Once your Magento 2 Elasticsearch configuration is complete, your Cloudways managed Magento store will be ready to generate more sales and less cart abandonment. If you still don’t have a managed store hosted on Cloudways, it’s time for you to join the next stage of evolution of Magento ecommerce hosting.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Great speed, features, knowledgebase, dashboard, UX and fast, expert support. Very happy!”

Stefan [Management Consultant]

Fayyaz Khattak

Fayyaz, a passionate Motorbike tourist, works as a Team Lead — Magento Community at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. You can contact him at [email protected]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!