
How to Configure ElasticSearch in Magento 2?
Magento is a PHP-based open-source e-commerce platform. More than 100,000 online stores have developed on this e-commerce platform. It has made nearly $155 billion in merchandise sales. In terms of sales, it has accounted for over 18 percent of market sales in the past two years. Starting from scratch with your Magento store, it’s best to choose a Magento development company that can lay a solid foundation for your store. Also, you should integrate your store with robust search engines like ElasticSearch to make it very interactive with the user.
What is ElasticSearch?
ElasticSearch is a search engine that can handle both text and image queries. ElasticSearch is Freeware, which means you can use it for free but not resell the code. The search engine’s detailed REST APIs, scalability options for large data sets, distributed nature, and versatility are the most appealing features. ElasticSearch can process, analyze, evaluate, and map data in order to make its use as efficient as possible. You can hire Magneto 2 developer from a reputed development firm if you already have a Magento store and wish to integrate ElasticSearch with it.
Benefits of using the ElasticSearch
Elasticsearch comes with a slew of other intriguing capabilities, including:
- We’ve all had the experience of auto-completion. When we start typing something in Google, the search bar populates with suggestions based on our search criteria. Merchants can use Elasticsearch to host an auto-completion function on their E-commerce website so that customers can easily see and browse the available products without pressing enter every time.
- Also, Elasticsearch delivers high performance to manage and analyze petabytes of data in parallel. Further, allowing it to identify the best matches for your searches quickly. From the time a document is indexed until it is searchable, Elasticsearch’s Lucene architecture drastically reduces latency.
- Do you know the ElasticSearch documents are kept in several containers? These containers are known as Shards. Further, copy the redundant copies of the data when the hardware gets fails. Moreover, its distributed structure enables to scale of hundreds of servers and handles petabytes of data.
- Elasticsearch supports several programming languages, including Java, Python, PHP, JavaScript, Node.js, and Ruby. Its simple REST-based APIs, HTTP interface, and use of schema-free JSON documents make it easy to start and quickly develop apps for different scenarios.
- Kibana, a popular visualization, and reporting tool are pre-integrated with Elasticsearch. It also works with Beats and Logstash, making it easy to alter and load data into your Elasticsearch cluster. You may also use open-source Elasticsearch plugins like language analyzers and suggestions to enhance the functionality of your apps.
A Step-by-Step Guide to Configure Elasticsearch in Magento
In this article, we’ll look at configuring Elasticsearch in Magento 2. But first, make sure you have the Elasticsearch engine loaded on your server. You can get in touch with the Magento development company to configure ElasticSearch.
To set up Magento to use Elasticsearch, follow these steps:
- As an administrator, log in to the Admin.
- Select Stores > Settings > Configuration > Catalog > Catalog > Catalog Search from the Stores drop-down menu.
- Select your Elasticsearch version from the Search Engine drop-down menu.
The required configuration parameters to configure and test the connection with Magento are listed below. The defaults should work unless you altered the Elasticsearch server settings. Go straight to the next stage. Therefore, you need to follow the instructions below to set up Elasticsearch.
- Elasticsearch Server Hostname: Enter the hostname of the Elasticsearch server. Localhost is the default.
- Elasticsearch Server Port: Type in the Elasticsearch Server port
- Elasticsearch Index Prefix: To determine the Elasticsearch index, enter a prefix. Magento2, for example.
- Enable Elasticsearch HTTP Auth: Select “Yes” to utilize HTTP authentication and access Elasticsearch Server by providing a username and password.
- Elasticsearch Server Timeout: Here, you can enter the number of seconds until the system times out. 15 is the default value.
- Test Connection: Click the Test Connection button to validate the configuration.
If the test gets fail, you need to try the following steps:
- Ascertain that the Elasticsearch server is up and operating.
- Log on to the Magento server and ping the Elasticsearch host if the Elasticsearch server is on a separate host. Fix any network connectivity problems and retest the connection.
- Moreover, before you start Elasticsearch, Look for stack traces and exceptions in the command window. Before you continue, you must resolve these issues. Ensure that Elasticsearch was launched as a user with root access.
- Also, ensure that the UNIX firewall and SELinux are turned off and set rules to allow Elasticsearch and Magento to communicate.
- Check the Elasticsearch Server Hostname field’s value. Assure that the server is up and running. In fact, you can also use the server’s IP address.
- Further, make use of the netstat -an | grep **listen-port** command to confirm that the port specified in the Elasticsearch Server Port field is not used by another process.
Step 2: Clear your browser’s cache.
You can execute this through the Admin panel or the command line.
From the Administrator’s Panel
- Select System > Cache Management from the dashboard.
- Click Submit after checking the Page Cache box and confirming the Refresh selection.
Step 3: Refreshing the whole page cache and reindexing the catalog search
You must reindex the catalog search index and refresh the complete page cache using the Admin or command line after changing Magento’s Elasticsearch setup. In fact, you hire Magento 2 developer to refresh the cache by using the admin. Follow the below steps:
- First of all, go to the admin search Cache Management, and click on the System.
- Next to Page Cache, pick the box.
- Click Refresh from the Actions menu in the upper right corner.
Use the Magento cache: Clean command to clear the cache from the command line.
Using the command line, reindex:
- Switch to the file-system owner or log in as the file system owner on your Magento server.
- Enter the following command. To reindex simply the catalog search index, run the following command:
bin/magento indexer:reindex catalogsearch_fulltext
And, to reindex all the indexers, enter the following commands:
bin/magento indexer:reindex
- Now, wait till all the reindexing gets complete.
Conclusion
We hope the detailed information might give you ideas on how to configure Elasticsearch in Magento 2. If you find a problem in configuring Elasticsearch, contact the Magento development company. The professionals will follow the best technique to configure the extension with your Magento 2 store.
1 Comment
[…] Magento is a PHP-based open-source e-commerce platform. More than 100,000 online stores have developed on this e-commerce platform. It has made nearly […]