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 #
- Log in to the Magento Admin.
- Go to
Stores > Settings > Configuration
- Select
Catalog > Catalog
. - Opend the
Catalog Search
tab. - 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 #
- Login into Admin area.
- In the Admin, click
System > Cache Management
. - Click on the checkbox that is next to Page Cache.
- From the Actions list on top right, select Refresh.
- 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 #
Magento 2 Mode
The Magento 2 store can run in different modes, depending on the environment, that can increase speed load.
ReadMagento 2 Import
Magento 2 Import tutorial and How To for Products Import, Categories Import, Customers Import or Tax Rates Import.
ReadMagento 2 API
Magento 2 API tutorial for setting up authentication, Authentication types and URLs that can be used.
ReadMagento 2 Cache
Magento 2 Cache tutorial on different usage scenarios and why Cache should be enabled on your store.
ReadMagento 2 Varnish
Magento 2 Varnish. What is Varnish and how it can be used and configured in a Magento 2 store.
Read