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.
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:
- Webserver (Apache or Nginx)
- Composer
- MySQL
- 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.
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.
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:
- Make sure your Elasticsearch is up and running on a different host from Magento (Adobe Commerce).
- In some cases, there might be network connectivity issues. Resolve them and try your connection test again.
- 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.
- 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.
- Check the Elasticsearch Server Hostname field’s value. Check that the server is up and running. Instead, try the server’s IP address.
- 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.
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.
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.
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.
Clean the cache by using the
magento cache:clean
command.
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.
What is Elasticsearch?
But, before we proceed ahead allow me to break down those quirky words for you. Elasticsearch is a:
- 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.
- 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.
- Full-text search engine: A comprehensive search method that compares every word of the search request against every word within the document or database.
Key Features and Benefits of Using Elasticsearch
Along with the aforementioned advantages, Elasticsearch also packs loads of other interesting features like:
- Auto-completion
- High Performance
- Elasticsearch Shards to avoid Hardware Failure
- Easy Application Deployment
- Complimentary Tools and Plugins
What is Magento (Adobe Commerce)?
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.
Key Features and Benefits of Magento (Adobe Commerce)
- Multichannel Commerce
- Scalability with Improved Performance
- Security and Reliability
- Community Support
- Myriad Payment Method Support
Conclusion
- 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 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.
learning Magento 2 Elasticsearch configuration and the Magento (Adobe Commerce) integrations that you use on a daily basis Sign Up for a 14-day free trial and experience the feature-rich Hevo suite firsthand.
Divyansh is a Marketing Research Analyst at Hevo who specializes in data analysis. He is a BITS Pilani Alumnus and has collaborated with thought leaders in the data industry to write articles on diverse data-related topics, such as data integration and infrastructure. The contributions he makes through his content are instrumental in advancing the data industry.