Magento 2 Elasticsearch: Make Site Search Effective

By: Published: November 23, 2021

Magento 2 Elasticsearch- Featured Image

Ask any online merchant about the importance of Site Search Optimisation on online stores and it’s very likely you’ll hear answers- It’s like having burgers and fries. The two need to be together for a scrumptious meal. 

In the same way, hosting an online store on Magento (Adobe Commerce), but without a Site Search Engine can drop your conversion rates. In an ever-increasing digital economy, customers expect more in less time. They seek improved product discoverability with user experiences that provide relevant results and a smooth trip to the product detail page.

Magento 2 Elasticsearch configuration allows you to search products based on a variety of criteria, as well as add information to the index without reindexing completely. It’s reliable, simple to use, and can be configured with a variety of options right out of the box. 

An effective search functionality from Magento (Adobe Commerce) Elasticsearch provides a variety of benefits to businesses that, when used correctly, can lead to increased conversions and improved customer retention. Continue reading to learn how to set up the Magento 2 Elasticsearch feature in your Magento (Adobe Commerce) Admin Panel.

Blog Outline 

What is Elasticsearch?

Elasticsearch Logo: Magento 2 Elasticsearch Configuration
Image Source: PNGkit

To put it in one line as a succinct but intimidating explanation, Wikipedia mentions Elasticsearch as a distributed, multitenant-capable, full-text search engine with an HTTP web interface and schema-free JSON documents. In plain language, it’s kind of like a Google Search.

But, before we proceed ahead allow me to break down those quirky words for you. Elasticsearch is a:

  1. Distributed: A search engine strategy that utilizes a large number of computers and networks to conduct Indexing, Query Processing, and Web Crawling operations. Multiple computers and networks are used in this distributed model idea to supply processing and bandwidth resources.
  2. Multitenant-capable: A feature that enables a single instance of the software and its supporting infrastructure to serve multiple customers. This becomes important for scalability and cost distribution across public and private clouds.
  3. Full-text search engine: A comprehensive search method that compares every word of the search request against every word within the document or database.

Elasticsearch provides a free & open search and analytics engine for all types of data, including textual, numerical, geospatial, structured, and unstructured. Elasticsearch is built on Apache Lucene, a Java-based search and indexing library, and was first released in 2010 by Elasticsearch N.V (now known as Elastic).

Elasticsearch’s indexing capabilities are what allow it to deliver search results quickly and reliably. Rather than searching the text, it looks for indices. An Elasticsearch index is similar to a database in a relational database schema that is linked and logically related to other databases. For better understanding, in the context of an E-commerce website, for example, you can have an index for Customers, one for Products, one for Orders, and so on that bears a relationship with one another.

Key Features and Benefits of Using Elasticsearch

Along with the aforementioned advantages, Elasticsearch also packs loads of other interesting features like:

  • Auto-completion: We’ve all experienced it. Once we start typing something in Google, the search box automatically displays suggestions based on what we are trying to search. Elasticsearch also supports an auto-completion feature for merchants to host on their E-commerce website so customers can easily see and browse for the available products without the hassle of pressing an enter every time. 
  • High Performance: Elasticsearch can manage and analyze petabytes of data in parallel, allowing it to quickly find the best matches for your searches. Elasticsearch’s Lucene architecture dramatically decreases latency from the moment a document is indexed until it becomes searchable.
  • Elasticsearch Shards to avoid Hardware Failure: The documents stored in Elasticsearch are distributed across different containers known as shards, which are duplicated to provide redundant copies of the data in case of hardware failure. The distributed nature of Elasticsearch allows it to scale out to hundreds (or even thousands) of servers and handle petabytes of data.
  • Easy Application Deployment: Elasticsearch supports a wide range of programming languages, including Java, Python, PHP, JavaScript, Node.js, Ruby, and many others. Its basic REST-based APIs, HTTP interface, and usage of schema-free JSON documents make it simple to get started and quickly build apps for a range of use-cases.
  • Complimentary Tools and Plugins: Elasticsearch is pre-integrated with Kibana, a popular visualization, and reporting tool. It also integrates with Beats and Logstash, allowing you to simply modify and load source data into your Elasticsearch cluster. To add additional functionality to your apps, you can also employ a number of open-source Elasticsearch plugins such as language analyzers and suggestors.

To learn more about Elasticsearch and its features, visit Elastic’s official website here- Elasticsearch features.

What is Magento (Adobe Commerce)?

Magento E-Commerce Logo: Magento 2 Elasticsearch Configuration
Image Source

Magento (Adobe Commerce) comes as a bigwig among other popular E-commerce Hosting Solutions because of its flexible and stand-alone Shopping Cart System that allows you to have full access to the code as well as control over the look, content, and functionality of the website. 

PHP framework of Magento (Adobe Commerce) allows programmers to create both static and dynamic websites, allowing for extensive customization. Varien Inc. first introduced the software in March 2018, however, a big rebuild occurred in 2015 after Magento (Adobe Commerce) was bought by Adobe. At present Magento, comes as a Cloud-based Solution that gets included in Adobe Commerce Cloud’s bundled offering. 

Adobe Magento Dashboard: Magento 2 Elasticsearch Configuration
Image Source: Adobe Experience Cloud

Magento (Adobe Commerce) 2.0, the upgrade, houses a surplus of features including SEO readiness, Multi-store support, Marketing tools, Deep analytics, Catalogue management, a robust shopping cart with support for multiple shipping addresses, and more. Combined with Adobe Experience Cloud, Magento 2 will bring Digital Commerce, Order Management, and Business Intelligence to enable both B2B and B2C shopping experiences across the customer journey.

According to Builtwith trends, Magento (Adobe Commerce) is the third most popular E-commerce Platform. It hosts 10,618 live websites at the time of writing among the top 1 million sites of E-commerce. 

Key Features and Benefits of Magento (Adobe Commerce)

  • Multichannel Commerce: Whether you’re a B2B ready to go direct to consumer (D2C) or a B2C managing several brands in 10 different languages, Adobe Commerce powered by Magento allows you to manage various Sales Channels and Brands while expanding into new nations from a single platform.
  • Scalability with Improved Performance: With a modular core and headless features, Magento (Adobe Commerce) is entirely scalable and extendable. Magento (Adobe Commerce) 2.0 is a layered design with four performance-optimized tiers, and it includes a variety of enhancements to minimize page weight and improve response times as your store website grows.
  • Security and Reliability: The Magento (Adobe Commerce) Platform is extremely safe, with long-established processes and controls that comply with industry-accepted standards, regulations, and certifications. Some of the built-in security measures include enhanced password management and improved prevention of cross-site scripting (XSS) attacks. Magento (Adobe Commerce) now includes a Security Scan Tool for identifying security issues, updating malware updates, and detecting illegal access.
  • Community Support: If there is one area where the Open Source E-commerce Platform has a clear edge, it is unquestionably the Community Support. Magento (Adobe Commerce) provides a large worldwide community of E-commerce developers, contributors, and innovators to connect with, learn from, and collaborate with. Users can also enroll in Adobe Community Insider Programme to gain access to Magento (Adobe Commerce) Source Code, a Cloud Sandbox Account, and early software updates, fixes, and tools.
  • Myriad Payment Method Support: Magento (Adobe Commerce) is compatible with a wide range of payment gateways and comes pre-installed with many of them. It works with popular payment gateways such as PayPal, Stripe, CartaSi, SagePay WorldPay, 2Checkout, and EBizCharge with a superior check-out experience that doubles as a positive for both online merchants and customers.

Hevo, A Simple Speedy Solution to Data Migration

Hevo offers a faster way to move data from databases or SaaS applications like Magento (Adobe Commerce), Elasticsearch & 100+ other Sources into your Data Warehouses like Redshift, Google BigQuery, Snowflake and Firebolt to be visualized in a BI tool. Hevo is fully automated and hence does not require you to code.

Get Started with Hevo for Free

Check out some of the cool features of Hevo:

  • Completely Automated: The Hevo platform can be set up in just a few minutes and requires minimal maintenance.
  • Real-time Data Transfer: Hevo provides real-time data migration, so you can have analysis-ready data always.
  • 100% Complete & Accurate Data Transfer: Hevo’s robust infrastructure ensures reliable data transfer with zero data loss.
  • Scalable Infrastructure: Hevo has in-built integrations for 100+ sources (with 40+ free connectors) that can help you scale your data infrastructure as required.
  • Tremendous Connector Availability: Hevo houses a diverse set of Connectors that authorize you to bring data in from multiple data sources such as Magento (Adobe Commerce), Elasticsearch, Shopify, Amplitude, Jira, and Oracle, and even Data-Warehouses such as Redshift and Snowflake in an integrated and analysis-ready format.
  • 24/7 Live Support: The Hevo team is available round the clock to extend exceptional support to you through chat, email, and support calls.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Live Monitoring: Hevo allows you to monitor the data flow so you can check where your data is at a particular point in time.
Sign up here for a 14-Day Free Trial!

Perks of Using Magento 2 Elasticsearch

Elasticsearch can serve as a perfect choice for your E-commerce Hosting Solution like Magento 2 (Adobe Commerce). Magento 2 Elasticsearch incorporates a strong recommendation engine for better product discovery and offers an analysis of time-series data (logs, metrics, etc.) with geospatial information. What’s more interesting is that merchants can use Elasticsearch to create autocomplete functionality and contextual suggestions on their products, analyze linguistic content, and build anomaly detection features.

Magento 2 Elasticsearch helps bring speed and scalability to growing online stores. Customers when particularly faced with slow response times can leave and create high bounce rates. Elasticsearch’s fast response engine can return sub-second responses on huge datasets giving it near real-time performance; hence offering a seamless experience for visitors. Elasticsearch can also be readily scaled between servers and can balance the load among cluster nodes. It can run on any system, but it can also be deployed over hundreds of servers and store petabytes of data. Scaling is simple since increasing the number of clusters is almost totally automated and painless.

As another distinguishing feature, Elasticsearch is also highly helpful for online merchants because of its fuzzy search feature. Oftentimes customers can type wrong words and there are chances that if the search engine doesn’t recognize it, it may lead to delivering zero matching results, compelling the customer to correct their search and type it again. With Elasticsearch, this is not a problem since Elasticsearch supports keyword matches even for fuzzy words, hence allowing for spelling mistakes or mistyping. As an example, if a customer types “jackts” the Elasticsearch will recognize it as “jackets” and deliver the matching results.

Elasticsearch Magento (Adobe Commerce) keyword matching will also remove ‘stop words,’ which means that if terms like ‘to,’ ‘the,’ ‘and,’ and so on which get included in the search phrase, those words would be deleted, leaving just the remaining words to match, resulting in more accurate results. Searching for ‘the product’ or ‘product’, for example, would provide the same results.

Prerequisites for Magento 2 Elasticsearch Configuration

Magento 2 Elasticsearch Configuration requires users to have Magento (Adobe Commerce) version 2.4.x installed in their systems. Adobe is pulling out support for Adobe Commerce 2.3.x by the end of April 2022 and PHP 7.3 reaches the end of support this year in December 2021. Therefore, it’s advisable for users to upgrade to Adobe Commerce 2.4.x and PHP 7.4.x to help maintain PCI compliance.

The current installation flow for Magento (Adobe Commerce) Open Source 2.4.x requires users to install Elasticsearch as a prerequisite software with other dependencies including:

  1. Webserver (Apache or Nginx)
  2. Composer
  3. MySQL
  4. PHP

in their Server Environment. So, Elasticsearch is a capability that comes as a complimentary add-on to the Magento (Adobe Commerce) Platform. If you are upgrading to Magento (Adobe Commerce) 2.4.x from previous versions, it’s recommended that you install and configure Elasticsearch before upgrading to Magento 2.4.x. You can find Elasticsearch in the package formats for different platforms here- Installing Elasticsearch

As of Adobe Commerce and Magento (Adobe Commerce) Open Source 2.4.0, Elasticsearch 7.6.x is required for all installations. Hence ensure that you are using Elasticsearch version 7.6.x.

Magento 2 Elasticsearch Configuration for E-Commerce Marketplaces

Elasticsearch comes as a default in-built service with Magento (Adobe Commerce) 2.4.x. Magento 2 Elasticsearch delivers accurate results to customers with quick and advanced searches on products along with support for multiple languages and stop words; all out of the box.

In the following sections, we’ll be discussing how to configure Magento 2 Elasticsearch Connection from the Catalogue Configuration.

Part 1: Configuring Magento 2 Elasticsearch Connection

To configure Magento 2 Elasticsearch connection from Magento 2 (Adobe Commerce) Admin Panel:

Step 1: Log in to your Magento 2 (Adobe Commerce) Admin Panel.

Step 2: After logging in, navigate to Stores > Configuration. On the Configuration page, you’ll find the Catalog section. Click on it to expand the section. 

Magento Admin Panel Configuration: Magento 2 Elasticsearch Configuration
Image Source: Magento (Adobe Commerce) Docs

Step 3: Under the Catalog Section head to Catalog > Catalog Search. Expand the section by selecting the down arrow beside the header. Here you’ll find an option to set up the Magento 2 Elasticsearch Search Engine. 

Magento Search Engine Settings: Magento 2 Elasticsearch Configuration
Image Source: Magento (Adobe Commerce) Docs

You can fill in these fields as per the following instructions:

  • Accept the default value Elasticsearch 7 for Search Engine. Elasticsearch 7.6.x is required for all Adobe Commerce installations in general.
  • Accept the default value for Elasticsearch Server Hostname that was set when Magento 2 (Adobe Commerce) was installed. The default value, in this case, is elasticsearch.internal.
  • Accept the default value for Elasticsearch Server Port that was set when Commerce was installed. The default value, in this case, is 9200.
  • Enter a prefix to identify the Elasticsearch Index in Elasticsearch Index Prefix. The default value is Magento2 (Adobe Commerce).
  • To use HTTP authentication to prompt for a username and password to access Elasticsearch Server, set Enable Elasticsearch HTTP Auth to Yes.
  • Enter the number of seconds before the system times out for Elasticsearch Server Timeout. The default setting is 15.
  • Click Test Connection to confirm the setup.

Note: If your connection test is unsuccessful, try the following:

  1. Make sure your Elasticsearch is up and running on a different host from Magento (Adobe Commerce).
  2. In some cases, there might be network connectivity issues. Resolve them and try your connection test again. 
  3. Look for stack traces and exceptions in the command window where you began Elasticsearch. Before you can proceed, you must first overcome those issues. Make sure that Elasticsearch was launched as a user with root access.
  4. Make sure that the UNIX firewall and SELinux are both turned off, or configure rules to allow Elasticsearch and Magento (Adobe Commerce) to interact with one another.
  5. Check the Elasticsearch Server Hostname field’s value. Check that the server is up and running. Instead, try the server’s IP address.
  6. To ensure that the port entered in the Elasticsearch Server Port field is not being utilized by another process, run 
netstat -an | grep **listen-port**

Part 2: Configuring Magento 2 Elasticsearch Search Options

Prior to the section for setting up Magento 2 Elasticsearch connection under Catalog Search, you’ll find another part offering configuration for general search.

Magento Query Settings: Magento 2 Elasticsearch Configuration
Image Source: Magento (Adobe Commerce) Docs

Here, you can specify:

  • Minimum Query Length, which translates to the minimum number of characters users need to type before they are able to see Magento 2 Elasticsearch recommendations or suggestions. The system default value, in this case, is 3.
  • Maximum Query Length, which translates to the maximum number of characters users can type to see results. The system default value is 128 in this case.
  • If you would like to cap the number of popular search results for faster responses, you can set the same in the Number of top search results to the cache field. The default value is 100. Entering a value of 0 caches all search terms and results when entered a second time.
  • Enable or disable EAV Indexer for improving indexation speed and restrict the use of indexer from third-party extensions.
  • To limit the maximum number of search results to display for Magento 2 Elasticsearch autocomplete, set an amount for Autocomplete Limit. Restricting this amount increases the performance of searches and reduces the displayed list size. The default value is 8.

Part 3: Configuring Magento 2 Elasticsearch Suggestions and Recommendations

Using Magento 2 Elasticsearch search recommendations and suggestions serves as a great feature for visitors to find information on products. Elasticsearch search engine helps customers find what they are looking for and recommendations engine suggests alternatives or newer versions of the items extracting information from the customer’s search history.

Note: Using Elasticsearch Magento 2 (Adobe Commerce) search suggestions and recommendations can impact server performance.

Magento Search and Recommendation Settings: Magento 2 Elasticsearch Configuration
Image Source: Magento (Adobe Commerce) Docs

In the following sections you can enable:

  • Elasticsearch Search Recommendation from Enable Search Recommendations field and select the number of recommendations to offer in Search Recommendations Count field.
  • Similarly, you can Enable Search Suggestions and specify its count under Search Suggestions Count.
  • To show the number of results found for each suggestion or recommendation, set Show Result Count for Each Suggestion and Show Result Count for Each Recommendation to Yes.
  • Set a value for Minimal Terms to Match to indicate the minimum number of terms from your query that the search results must match in order to be returned. This guarantees that shoppers get the most relevant results.

When you are done, hit the Save Config button on the top right corner.

Magento Configuration Page: Magento 2 Elasticsearch Configuration
Image Source: Mageplaza

Part 4: Reindexing Catalog Search and Refreshing the Full Page Cache

After changing the Magento (Adobe Commerce) Elasticsearch configuration in Magento (Adobe Commerce), you must reindex the catalog search index and refresh the complete page cache using the Admin or command line.

To use the Admin to refresh the cache:

Step 1: Click System > Cache Management in the Admin.

Step 2: Check the box next to Page Cache.

Step 3: Click Refresh from the Actions menu in the top right. An example is shown in the image below.

Magento Refreshing Page Cache: Magento 2 Elasticsearch Configuration
Image Source: Magento (Adobe Commerce) Docs

Clean the cache by using the

magento cache:clean 


To reindex using the command line, follow these steps:

  • Log in as, or switch to, the file system owner on your Magento (Adobe Commerce) server.
  • Enter one or more of the following commands:

To reindex the catalog search index, use the following command:

$ bin/magento indexer:reindex catalogsearch_fulltext

To reindex all indexers, use the following command:

$ bin/magento indexer:reindex

Wait for the reindexing process to complete. You’re done after that.


Magento (Adobe Commerce) Elasticsearch configuration makes site search easy and effective for your customers. The search capability works out of the box and delivers accurate search results with real-time data and analysis that can significantly reduce bounce rates and provide customers access to additional relevant information.

To open their businesses, online retailers use several E-commerce systems such as Magento (Adobe Commerce). While the basic add-ins and integrations are useful, connecting many services to a single source of truth becomes too expensive for many. Hevo Data is a technology that was created expressly to handle the issue of heterogeneous data source connection, allowing Small and Medium Businesses to operate smoothly with their everyday applications.

Hevo Data with its strong integration with 100+ Sources such as Magento (Adobe Commerce) and Elasticsearch allows you to not only export data from sources & load data in the destinations, but also transform & enrich your data, & make it analysis-ready so that you can focus only on your key business needs and perform insightful analysis using BI tools. 

Visit our Website to Explore Hevo

Hevo lets you migrate your data from your Magento (Adobe Commerce) Admin to any Data Warehouse of your choice like Amazon Redshift, Snowflake, Google BigQuery or Firebolt within minutes with just a few clicks.

Want to take Hevo for a spin? Sign Up here for a 14-day free trial and experience the feature-rich Hevo suite first hand.

In the comments section below, share your thoughts on learning Magento 2 Elasticsearch configuration and the Magento (Adobe Commerce) integrations that you use on a daily basis. We’d like to hear your opinions and suggestions.

Divyansh Sharma
Former Content Manager, Hevo Data

With a background in marketing research and campaign management at Hevo Data and myHQ Workspaces, Divyansh specializes in data analysis for optimizing marketing strategies. He has experience writing articles on diverse topics such as data integration and infrastructure by collaborating with thought leaders in the industry.

Simplify Data Migration with Hevo