If you tried to install Magento 2 Elasticsearch on Ubuntu and came across the message Magento 2 Elasticsearch connection failed then this is the article for you. Here we will first discuss thoroughly what is Magento 2 Elasticsearch, and then we will go through the process of installing as well as configuring the Magento 2 Elasticsearch on Ubuntu.
What is Elasticsearch ?
This blog, helps the users to integrate the Elasticsearch engine inside the web store, Magento 2. The Elasticsearch is one highly scalable and open-sourced plus full-text engine for analytics and search.
Moreover, it allows the users to store, plus search, as well as analyze large amounts of data speedily that too in nearly real-time. This is usually used as an underlying engine or technology which powers the applications that possess complex features for search and requirements. Therefore, the benefits of the Elasticsearch for Magento 2 are quite useful.
Some of the features
Some of this most beneficial features of this are mentioned below:
- Did You Mean
This feature enables the clients to look for the products even if they by mistake enter the wrong name of the product, by suggesting to them all the various products that have nearly the same product name as the one they searched for.
- Spell Correction In Search
The Admins are able to set the levels of spell correction at 1 or 2. The Elastic Search Engine will automatically correct the typed keywords even when they are incorrectly typed by the Client.
- Synonym Filter
The admins can also add numerous synonyms for various products, plus categories and if the Client searches for either one of these synonyms or words then the search engine’s result page will display all the related results to these synonyms or words.
- Search Suggestion
With this Search suggestion feature, all the clients can search for Categories, and Pages as well as Products only by typing the Keywords.
The utility of the Magento 2 Elasticsearch module
If the users are coming across slow along with poor fetching of the search results in their e-commerce site, plus are looking for another solution where they can have a quick retrieval, in that case, Elasticsearch is the one solution that will be of use to them. Because Elasticsearch is one such search engine. Moreover, it is highly scalable as well as open-sourced and a full-text engine for search.
Using the module of Magento 2 Elasticsearch, one can render his/her customers with a sound and smooth experience of search. This module will narrow down the search results. Plus it will allow the users to search, as well as analyze the immense amount of data in no time.
Some additional features
- Admins can without any trouble update the products, and categories as well as data of cms pages to the elastic servers.
- The Admins can also set the Cron for management of the index on either a daily, or weekly or even monthly basis in order to apprehend the changes accordingly and as per requirement. Moreover, Admins can use the tool of command-line to update the data of the website to the elastic servers.
- If the query ‘Multi-Match’ has been chosen as the type of search, then the customers can search for data by either name, SKU, or description as well as with a brief description of the commodity.
- It also possesses the feature of Spell Correction, according to this the search engine will automatically correct the keywords if the customers type them incorrectly.
- Admins can choose the character filters in order to replace and if required then remove the unwanted characters of the search input. Moreover, the Admins are able to select the Language Stemmer but store wise and according to the language of the store.
Magento 2.3 Elasticsearch configuration and install process
Follow the given steps to install the Elasticsearch.
Begin by updating the index of the package and installing the package of apt-transport-https.
sudo apt update
sudo apt install apt-transport-https
The next step is to install the OpenJDK 8.
sudo apt install openjdk-8-jdk
Now you need to verify the Java installation with the help of the command mentioned below and the output would something like the one shown in the image.
After successful verification, add the repository of Elasticsearch with the help of the wget command mentioned below:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Now add Elasticsearch repository to the system.
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
If needed change the 7.x with the version you are using.
Next, update the apt package’s list and install the Elasticsearch engine.
sudo apt update
sudo apt install elasticsearch
Start the Elasticsearch service.
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
Verify that Elasticsearch is running or not.
curl -X GET "localhost:9200/"
The result will be:
Run the following command to see logged messages by Elasticsearch.
sudo journalctl -u elasticsearch
Now you have successfully installed the Magento 2 community Elasticsearch successfully on the Ubuntu server.
- To configure search option:
- Tap Stores--->Configuration
- Choose Catalog
- Expand Catalog Search
- Choose the version that is installed on your server
- Set the EAV Indexer
- Set the Query Length
- Set the number of top search results to cache
- Set the Autocomplete Limit
Configure the Elasticsearch Connection
- Enter the Elasticsearch Server Hostname
- Enter the Elasticsearch Server Port
- Enter the Elasticsearch Index Prefix
- Set the Enable Elasticsearch HTTP Auth to “YES”
- Enter the Elasticsearch Server Timeout
Set Enable Search Suggestions to “YES”, afterward Configure suggestions and recommendations as follows:
- Enter Search Suggestion Count
- Set the Show results count for each suggestion
Set Enable Search Recommendations to “YES”, then:
- Enter the Search recommendations count
- Set the show results count for each recommendation
- After completion, click ‘save config’.
So above we discussed what exactly is Magento 2 Elasticsearch, what are its features and how is it useful. Therefore, you must have a clear understanding of this by now. Further, we understood the installation and configuration procedure for Magento 2 Elasticsearch on Ubuntu. Hence, you can easily install and use it now.