Magento 2 Elasticsearch

Magento 2 Elasticsearch

Magento 2 Elasticsearch tutorial on how to use and configure as the primary search engine.

" Elasticsearch Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.”

In translation to Magento 2 it's a search engine that can be used to provide better results and search speeds.

Setup #

Install #

Configuration #

  1. Log in to the Magento Admin.
  2. Go to Stores > Settings > Configuration
  3. Select Catalog > Catalog.
  4. Opend the Catalog Search tab.
  5. In the select Search Engine list, select the corresponding Elasticsearch version.

With the above in place you will have the following inputs available for specifying:

  • Elasticsearch Server Hostname - hostname or IP address of the machine running Elasticsearch.
  • Elasticsearch Server Port - Elasticsearch web server proxy port.
  • Elasticsearch Index Prefix - Elasticsearch index prefix.
  • Enable Elasticsearch HTTP Auth - Set only if your Elasticsearch server requires authentication.

Indexing #

After the Configuration step you must reindex the catalog search index and the full page cache. This can be done via admin and command line.

Cache refresh admin #

  1. Login into Admin area.
  2. In the Admin, click System > Cache Management.
  3. Click on the checkbox that is next to Page Cache.
  4. From the Actions list on top right, select Refresh.
  5. Click Submit.

Cache refresh Command Line #

To refresh the Full Page Cache after enabling Elasticsearch you can use command bellow:

$ bin/magento cache:clean full_page

This will output something like:

Cleaned cache types:
full_page

Reindex Command Line #

Reindexing after configuring Elasticsearch can be done only via command-line, the option to reindex via admin has been removed by the Magento team. Bellow will reindex the catalog search index only.

$ bin/magento indexer:reindex catalogsearch_fulltext

This will output something like:

Catalog Search index has been rebuilt successfully in 00:00:05

It is important to have Magento 2 Cron configured properly as Magento uses it to keep indexers in sync with main data.

Module #

Published: Dec 23, 2018. Updated: May 21, 2020.


Magento 2 SEO

We will help you with SEO ratings by providing some Magento 2 SEO Tips

Read

Magento 2 Cache

Magento 2 Cache tutorial on different usage scenarios and why Cache should be enabled on your store.

Read

Magento 2 API

Magento 2 API tutorial for setting up authentication, Authentication types and URLs that can be used.

Read
Magento 2 Google Analytics

Magento 2 Google Analytics

Magento 2 Google Analytics setup for a smooth integration between tracking in GA and your store.

Read
Magento 2 Cron

Magento 2 Cron

Magento 2 Cron tutorial on how to to configure and what is Cron needed for.

Read
Magento Security Scan Tool

Magento Security Scan Tool

Magento Security Scan is a tool provided by the Magento team that monitors your Ecommerce store and notifies you of security breaches.

Read
Contact
Hire us


Need help with Magento 2 Elasticsearch ?


Tech

Technologies we work with

Magento is an open-source e-commerce platform written in PHP
PHP is a popular general-purpose scripting language that is especially suited to web development.
MySQL is an open-source relational database management system.
Redis is an in-memory data structure project implementing a distributed, in-memory key-value database with optional durability.
Varnish is an HTTP accelerator designed for content-heavy dynamic web sites as well as APIs.
Google Tag Manager is a free tool that allows you manage and deploy marketing tags on your website / app
Google Analytics is a web analytics service offered by Google that tracks and reports website traffic
Elasticsearch is a search engine based on the Lucene library.