Back to Top

Magento 2 Elasticsearch Module

Updated 17 December 2024

You can include the Elasticsearch engine in your Magento 2 (Adobe Commerce) web store with the help of the Magento 2 Elasticsearch extension.

The elastic search engine is a highly scalable and open-source full-text search engine.

It enables quick storage, searching, and analysis of large volumes of data.

Also, it is a fast search engine that instantly displays the results of the given query.

Note: Elastic Search Engine v7.6 must be set up and functioning on the system before installing the Magento 2 Elastic search module.

Searching for an experienced
Magento 2 Company ?
Find out More

Also, if you want to enhance your store with the AI-powered image search for products, you can check Magento 2 AI Image Search.

You can also check our Magento 2 Semantic Search extension to enhance your store with the feature of searching products using natural language queries. 

Watch the video tutorial below to understand Magento 2 Elastic Search extension workflow:

7jKVd2YmNms

Features of Magento 2 Elasticsearch Extension

  • The elastic search engine can quickly replace the function of the MySQL search engine.
  • The elastic server’s admin can easily update the data for products, categories, and CMS pages on the server.
  • The index type determines how the data is saved on the elastic server.
  • The admin will use a command line program to update website data on the elastic server.
  • The Frontend’s search type can be adjusted by the Admin to either Multi-Match Query or Simple Match Query.
  • Customers can search data by name, SKU, description, and a product short description if Multi-Match Query has been chosen as the search type.
  • Customers can only find the products by name or SKU if a simple Match Query is chosen.
  • The spell-checking feature in the Magento 2 Elasticsearch plugin allows the search engine to rectify keywords even when they are entered improperly.
  • Customers can search for products if they accidentally type the incorrect product name using the Did you Mean button. As a result, this feature will recommend to them all the products with the same product name that is nearby.
  • The admin can choose character filters to replace or delete unwanted characters from the search input.
  • The admin can also choose a multilingual language stemmer under the language stemmer in the Magento 2 Elastic Search extension.

Installation of Magento 2 Elastic Search Extension

Installation of the Magento 2 elastic search plugin is easy. Admin needs to select the app folder into the Magento root folder on the server shown in the snapshot.

#Run Commands

Once the plugin is installed, the admin has to run the following commands in the Magento2 root directory.

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento elastic:index -a reindex all 

After running the commands, the admin has to log into the admin panel and clear the cache, according to the screenshot below.

Language Translation

To translate the module language, navigate through src/app/code/Webkul/ElasticSearch/i18n and edit the en_US.csv file.

Thereafter, rename the CSV as “en_SA.csv” and translate all right side content after the comma in the Arabic language. After editing the CSV, save it.

Now, upload it to the path src/app/code/Webkul/ElasticSearch/i18n where the installation of Magento 2 is on the server.

The module was translated into the Arabic Language. It supports both RTL and LTR languages.

The user can edit the CSV like the image below.

  • Admin configuration of Magento 2 Elasticsearch

After the successful installation of the Magento 2 Elastic Search extension on your Magento 2 store.

The admin will navigate through Stores > Configuration > Catalog > Catalog search > Search engine and then select Webkul Elasticsearch.

catalog search

Magento 2 Elasticsearch General Settings

Once the search engine got selected as Webkul Elasticsearch, the admin will navigate through Stores > Configuration > Webkul > Elastic Search Setting > General Settings.

general settings

Here the Admin has to enter/Select:-

  1. Add the elastic server hostname in the Host field.
  2. Port Number:- To configure the elastic server enter the port number.
  3. Index Prefix:- We are using an elastic search server on multiple websites. If we use an index prefix on websites, then at the time of re-indexing, that particular website data will not affect other websites.
  4. Check Connection Status:- Check the current status of the elastic server. 
  5. Reset Connection:- The connection will be reset if you choose this option, and all data will be deleted from the current elastic server. The administrator must manually reindex it by going to Elastic search > Index management.

Search Settings of Magento 2 Elasticsearch Extension

Here, The Admin can select any query as a search type for the frontend, such as Multi-Match Query or Simple Match Query:

1. Multi-Match Query

If the Multi-Match query search type enables, the customer can search for a product using its attributes. The attribute type must be text and created by the admin.

multi match query

  • Select Frontend Search Type: Choose the type of search.(e.g., Simple Match Query, Multi-Match Query).

  • Select Fields For Multi Search: Choose which data fields (like SKU, product name, category, etc.) should be included in a multi-field search.

  • Select Multi-Match Type – the admin needs to select multi-match type as the best field, most Fields, cross fields, phrase, and phrase prefixes.

  • Select Operator For Multi-Search– The admin can select the “AND” or “OR” operator for multi-search.

2. Simple Match Query

If Simple Match Query is selected in the search type, the customer can only search for a product by its name and SKU.

Single match query

  • Allow Spell Correction in Search: Select the accuracy level for the search queries.

  • Select Search Filters: Choose which filters (e.g., category, price, rating) users can apply to narrow down search results.

  • Enter Comma Separated List Elisions: Define words (like “the,” “and,” etc.) to be ignored or excluded in search indexing, entered as a comma-separated list.

Search Suggestion in Magento 2 Elastic Search Extension

In search suggestions, with the help of keywords, customers can search categories, pages, or products.

Magento 2 Elasticsearch Did You mean

When a customer enters the wrong product name, it will recommend all nearby products with the same product name to the customers. 

Shown in the below screenshot.

Spell Correction in Search

The Elastic Search Engine will automatically correct keywords when they wrote incorrectly by the customer if the spell check is set to Level 1 or Level 2 by the admin.

Select Search Filters

There are four types of search filters to modify the search term provided by the customer. The admin can select the token filters.

  1. Synonym Filter

The admin has to navigate through Marketing > Search Synonyms.

search synonyms

Admin can create a new synonym group from here. For example, the admin has added synonyms for jeans and pants.

create synonym group

Now, the search engine will display all the results connected to any of these keywords if the customer searches for one of them.

2. Elision Filter- An elisions-removing token filter. For example, “L’avion” (the plane) will be parsed as “avion” (plane).

3. Lowercase FilterA lowercase token filter that converts token text to lowercase.

4. Stop Word FilterStop words are removed from the search query. Examples of stop words are and, is, and to.

To learn more about token filters, please go through the following Link:

https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-tokenfilters.html

Select Language Stemmer

According to the language of the Magento 2(Adobe Commerce) store, the admin must choose the appropriate Language Stemmer. 

For example, if the store language is set as English, the customer can only search in English.

  • Select Language Stemmer: Choose the language for stemming words.
  • Enter comma separated words to exclude from stemming: List words to keep unchanged during stemming.

Select Character Search Filters in Magento 2 Elasticsearch

There are three types of character filters. That is used to remove unwanted characters from the search input.

image

ss

  1. HTML strip char filter– The HTML strip character filter strips off the HTML parts.
  2. Mapping Filter– The mapping filter swaps out the mapping keys with values. So, it will eliminate any character from the mapping in the Magento 2 Elasticsearch module.
  3. Pattern Replace Filter– The Pattern Replace Filter functions similarly to the Mapping Filter. The main difference is that it replaces patterns instead of mapping them. To replace characters, it makes use of a regular expression
  4. Enter Comma Separated List Of Filter Mappings: List multiple filter rules, separated by commas.
  5. Enter Pattern: Define the text or pattern to search for.
  6. Enter Pattern To Replace With Filter Pattern: Define the text or pattern to replace the found pattern.

To learn more about the character filters, please go through the following URL:

https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-charfilters.html

Index Management of Magento 2 Elasticsearch

Moreover, the admin can navigate through elastic search > index management.

elastic indexes

The admin can change the status of the index type. For the index type, the admin has two options: update on save mode or update on a schedule.

For example, the admin must change the status of a product index type whenever he adds a new product.

So, the admin can also use the system command line features if they have to change a large amount of data.

elastic-search.

That is all for the Magento 2 Elasticsearch module. Still, have any issues feel free to add a ticket and let us know your views to make it better at webkul.uvdesk.com.

Current Product Version - 5.0.3

Supported Framework Version - Magento 2.0.x, 2.1.x, 2.2.x,2.3.x, 2.4.x

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home

Table of Content