Magento-2-elasticsearch

3 Easy Steps To Configure Magento 2 ElasticSearch

by admin

In this article, we will show you a detailed guide to configure Magento 2 ElasticSearch – a robust and highly scalable catalog search solution that helps you optimize the search and retrieval function on your Magento 2 stores

For any Magento 2 stores, the search is undoubtedly one of the most important functions. An effective search can help buyers easily find their needed products on the store, this provides better customer experience and stimulated purchases.

Therefore, it’s essential to enhance the search feature in Magento 2 stores, and applying Elasticsearch is one of the best ways to do that.

Let’s explore!

Notes On Elasticsearch 6 & Elasticsearch 7 Updates

These are important updates to write down because changes to Elasticsearch are mostly internal and mapping-related types. However, you don’t need to worry that much about them since there are little to no different in configuring or administering the Elasticsearch. 

Elasticsearch 6

Here is a quick recap on Elasticsearch 6 release notes.

elasticsearch-6

  • Easier and cheaper to recovery with Sequence IDs in case of a node disconnected from the cluster because of a network problem or a node restart.
  • Include Lucene 7.0 which transfer how files and searches are stored. The sparse field lowers the disk space usage, merge time with better query throughput since Elasticsearch works the cache system to its highest capacity.
  • Allow index sorting thanks to the inclusion of Lucene 7.0. For example, if the sort is alphabetical-organised, then a search for entries beginning with “F” can quit when it reaches “G” because all items start with F have been read.
  • Delete mapping types. This is an attempt to ease out the learning curve for Elasticsearch beginners. The data structure with only one mapping type will be much easier to understand and use.

However, the seventh edition of this plugin has already in place for more than a year and since it’s mandatory for Magento 2.4 – we must talk about it!

Elasticsearch 7

The utmost selling points to upgrade to this version are scalability and resiliency.

Subsequently, Zen 2 – a new cluster coordination system is set in place. This system chooses which nodes can form a quorum by itself rather than the complicated algorithm with minimum_master_nodes setting. As a result, we have easier and faster (in milliseconds) master elections with little to room for setting flaws.

In the freshest form of Elasticsearch, a few enhancements were made for memory use and insurance against out-of-memory mistakes. The primary thing is the new electrical switch that monitors the memory utilized by the JVM. It utilizes a usefulness in the JVM to quantify current memory use rather than just representing the at present followed memory.

A hub will presently dismiss demands on the off chance that they surpass a limit of (default) 95% of the load distributed to the procedure. This will forestall OOM mistakes.

lesser-flaws

This will let loose the assets used to keep them open. This information must be reconstructed each time you need to look through these lists, which makes look on them more slow.

In addition, Elasticsearch 7 also brings out other features which make this version is the most valuale and worth updating.

elasticsearch-7

A Complete Magento 2 Elasticsearch Tutorial

#Step 1: Configure search options

  • From the Admin sidebar, go to Stores SettingsConfiguration.
  • In the panel on the left, choose CatalogCatalog. 
  • Expand the Catalog Search section.
elasticsearch-magento 2

READ NOW if you are also interested >>> Magento Default Search Vs Advanced Search And Fast Autocomplete

  • In Minimum Query Length: enter the query length at which the store starts using the Elasticsearch.
  • In Maximum Query Length: enter query length which the Magento 2 Elasticsearch is disabled if exceeded.
  • In Number of top search results to cache: enter the number of popular searches to store for faster response.
  • In Enable EAV Indexer, set Yes to improve indexation speed.
  • In the Search Engine, clear the Use system value checkbox and select the version of Elasticsearch which is installed on your server:
    • Magento Elasticsearch (Deprecated) – Elasticsearch 2.0+ has reached the end of life.
    • Elasticsearch 5.0+ (Default) – Elasticsearch 5.0+ is about to end of life.
    • Elasticsearch 6.0+ (Recommended) – For the best performance, you should use the latest version: Elasticsearch 6.0+.
  • In Autocomplete Limit: enter the maximum number of search results displayed for search autocomplete.

#Step 2: Configure Magento Elasticsearch connection

elasticsearch-server-hostname

  • Enter the Elasticsearch Server Hostname. The default is localhost
  • Enter the Elasticsearch Server Port.
  • Enter a prefix in the Elasticsearch Index Prefix field to determine the Elasticsearch index.
  • In the Enable Elasticsearch HTTP Auth:  select Yes to use HTTP authentication. This function suggests a username and password access Magento 2 Elasticsearch Server.
  • In Magento Elasticsearch Server Timeout: enter the number of seconds before the system times out. The default number is 15.
  • Click to the Test Connection button to verify the configuration.

#Step 3: Configure suggestions and recommendations

  • Set Enable Search Suggestions to Yes
    • In the Search Suggestions Count: enter the number of search suggestions to offer.
    • In the Show Results for Each Suggestion: set Yes to show the number of results found for each suggestion.
  • In the Enable Search Recommendations,  set Yes to offer recommendations.
    • In the Search Recommendation Count field, enter the number of recommendations to offer.
    • To show the number of results found for each recommendation, set Show Results Count for Each Recommendation to “Yes”.
  • Click the Save Config button. 

Sum It Up

We have shown a detailed guide to help you configure Magento 2 ElasticSearch. We hope that it is easy for you to follow. If you are not clear on anything, leave a comment below so that we can help!

EXPLORE NOW more built-in solutions from BSS Commerce

We are one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bring high-quality products and services to optimize our business effectively. Let us know about your problems. We are willing to support you every time.

Next Reading Suggestions

© 2019 BSS Commerce owned by THANH CONG INTER ., JSC. All Rights Reserved.
Business registration certificate no. 0106064469 issued by Hanoi Department of Planning and Investment on 19 December 2019.
Legal Representative: Mr. Nguyen Quang Trung.