Elasticsearch in Magento 2 is a search engine that allows you to enable search tools on your website and provide users with relevant information. This product can take data from any source, any format, and search and visualize it in real-time. Also, Elasticsearch supports multiple languages, stop words, and synonyms.
Unlike MySQL, Elasticsearch is highly customizable, extendable through plugins. You can build a robust search without much knowledge quite fast. While Elasticsearch is a must in the Magento 2.4 version, you can still make it more user-friendly with the Elastic Search extension.
To configure the query in the Elastic Search extension, do the following:
Step 1. Make a general configuration of the module by setting up the connection and setting Autocomplete suggestions & Spelling correction.
Step 2. Then navigate to Admin Panel > Stores > Product and choose a needed attribute. Next, go to the Storefront Properties option and switch the Use in Search option to Yes to add a product attribute to a search query configuration.
Step 3. Now, go to the Catalog settings section on the Configuration tab and specify the Search Query Settings for each product attribute:
Step 4. Specify the way to combine keywords in a search query for each product attribute:
Step 5. After that, complete Indexation Settings:
Step 6. Save the changes.
The minimal Magento 2 Elasticsearch version varies and depends on the version of Magento you use. Since Magento 2.4 release, all installations must be transferred from MySQL search engine to Elasticsearch. The minimal Magento 2.4 Elasticsearch version is 7.6. Elasticsearch 2.x, 5.x, and 6.x versions are not supported.
To configure the Magento 2 Elasticsearch query, go to Stores > Settings > Configuration. Then open the Catalog tab and click Catalog. Navigate to the Catalog Search section. Here you can set up the search query minimal and maximal length, the number of top search results to cache, indexer, and autocomplete limits.
Now you can go to the storefront and test if the search works correctly. Check the user guide for more details about extension settings.
The Elastic Search extension provides a wide range of features but to provide the user with a good search experience on any device, use the PWA add-on for Elastic Search to guarantee your customers a hassle-free product search from any device.
Login and Registration Form