Magento 2 Elasticsearch is a server-based tool that is capable of full-text searching at a very high speed. Powered by Apache Lucene (which is an open-source full-text search library), it offers a fast web content search capability it is able to achieve this speed because of an indexing service instead of searching the entire database for the match.
This is similar to the index of a book. In this case, indexes are made out of letters. So as soon as you start searching, Elasticsearch start producing matches as the query string is entered.
Why Use Magento 2 Elasticsearch?
According to Microsoft, the attention span of an average user surfing the internet has been reduced to just 8 seconds. Given this, online retailers must be able to sell quickly in less than 4 seconds. Another related fact is that the longer users spends on your site, the less likely it is that they will buy something. Think of it this way: Why would anyone stay in a store if the salesperson keeps on presenting something one does not want?
Elasticsearch is valuable in keeping your store’s search precise and fast for your potential customers. This enhances the customer’s experience and makes sure that they are able to make good use of their time on your store.
Configuring Server For Elasticsearch
You can quickly setup Elasticsearch on your store if you precisely follow the guide below. There are some prerequisites, make sure you fulfill them before you start.
- You have an activated server on Cloudways.
- You have an active Magento App installed on your server.
Prepare your server on Cloudways
- Login/Sign up to Cloudways Platform.
- Select Magento Application from the drop-down menu. Here, you should also name your application and server.
- Select Cloud Provider of your choice from the available infrastructure options.
- Choose your Server Size based on your needs. You can scale the size of your server whenever you feel the need.
- Select the Server Location of your choice; whichever is nearest to your audience. For each Cloud provider, you have the option of multiple data centers.
Now click on Launch Now button and wait for your server preparation.
After successfully configuring the Cloudways server, you need to enable Elasticsearch on your Cloudways server. To enable Elasticsearch on your Cloudways server, go to the Settings & Packages tab on the Servers screen.
Elasticsearch is now enabled on your server. Now let’s go through Magento 2 Elasticsearch configuration process.
With the recent release of Magento 2.3.0, Elasticsearch has become a default, greatly simplifying the configuration and store level integrations.
I will now demonstrate the ease with which you can set up Elasticsearch with your Magento 2 store.
Configure Magento 2 Elasticsearch – The Step-by-Step Guide
For Magento 2 Elasticsearch configuration:
- Log into the Magento Admin as an Administrator.
- Click Stores > Settings > Configuration > Catalog > Catalog > Catalog Search
- In Minimum Query Length, enter the query length at which Magento 2 Elasticsearch will get enabled.
- In Maximum Query Length, enter the length of the query for which Magento 2 Elasticsearch would remain enabled.
- In Number of top search results to cache, enter the number of popular searches that the module should store for faster response.
- Next, Enable EAV Indexer to Yes to improve indexation speed.
- Set the Search Engine to either MySQL, Elasticsearch and Elasticsearch 5.0+. I selected the Elasticsearch 5.0+ because it is easier to connect.
- In the field labelled Autocomplete Limit, enter the maximum limit for similar suggestions for each query.
- In Elasticsearch Server Hostname, enter the fully qualified hostname or IP address of the server that is running the Magento 2 Elasticsearch.
- In Elasticsearch Server Port, enter the Magento 2 Elasticsearch server proxy port. If ‘9200’ does not work for you, try ‘8080’. If you’re using a secure proxy, you can also use port ‘443’.
- Elasticsearch Index Prefix: You can use the default prefix magento2 but if you use a single Elasticsearch instance for more than one Magento installation, you will have to specify a unique prefix for each installation. This is because Magento has a multistore inventory feature, and if a single Elasticsearch is used on all stores, it would be difficult to distinguish between the stores.
- To Enable Elasticsearch HTTP Auth, select Yes. Next, provide a username and password in the specified fields. It is recommended that you keep it to No.
- In Elasticsearch Server Timeout, define the time after which your Magento 2 Elasticsearch server would time out. The time is in seconds.
- Enable Search Suggestions to Yes if you want to show suggestions in your Elasticsearch search space.
- In Search Suggestions Count, define the count for search suggestions. On an average, two suggestions are displayed with each search.
- If Show Results Count for Each Suggestion is selected as Yes then the count for each suggestion would be displayed.
- If you Enable Search Recommendations to Yes, recommendations will be displayed for search strings.
- In Search Recommendations Count, define the count for search suggestions
- If Show Results Count for Each Recommendation is selected as Yes, the count for results would be displayed with each suggestion.
Elasticsearch Extension for Magento Previous Versions
To configure ElasticSearch with your Magento store, Open your Magento admin panel.
In this tutorial, I will use Magento’s extension to use Elasticsearch. There are many products available in the market. However, I found Bubbleshop Elasticsearch Extension by Wyomind to be one of the finest paid services. You can get this Extension only on €95.
This will provide you a zip file. For installing the extension, download .zip file from Bubble Shop website and go to your public_html using FTP server and unzip the archive in your Magento root folder.
Note: Don’t forget to clear the Magento cache after unzipping.
Elasticsearch Settings in Magento
After uploading extension files on your Magento root directory, you need to go to System > Configuration > Catalog > Catalog Search > Search Engine.
And define Elasticsearch as default search engine. After that, make a “Category Products,” “Elasticsearch Product” reindex via System > Index Management.
After this go to System > Configuration > Bubble Extensions > Elasticsearch and customize the autocomplete features of this extension. (Autocomplete is enabled by default).
Once your Magento 2 Elasticsearch configuration has successfully been done on your Magento store using Cloudways! Your Cloudways Managed Magento store is now ready to give you more sales and less cart abandonment. If you still don’t have a managed Magento store hosted on Cloudways, then it is the right time for you to join the next significant evolution of cloud hosting.
Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. Fayyaz is a food lover and enjoys driving. You can email him at firstname.lastname@example.org
Double Your Conversions with Magento Managed Cloud
Free SSL, Free Migration, Optimized Stack, Built-in Varnished Cache and much more.