You are reading the documentation for version 2.2. Magento 2.3 is the latest version available. Ensure you are reading the documentation for your version of Magento.

Set up Elasticsearch service

Elasticsearch is an open source product that enables you to take data from any source, any format, and search and visualize it in real time.

  • Elasticsearch performs quick and advanced searches on products in the product catalog
  • Elasticsearch Analyzers support multiple languages
  • Supports stop words and synonyms
  • Indexing does not impact customers until the reindex operation completes

Magento Commerce supports Elasticsearch versions 1.4, 1.7, 2.4, and 5.2 (requires Magento Commerce v2.2.3 or later). The recommended version is 5.2.

To enable Elasticsearch:

  1. Add the elasticsearch service to the .magento/services.yaml file with the Elasticsearch version and allocated disk space in MB.

        type: elasticsearch:5.2
        disk: 1024
  2. Set the relationships property in the file.

        elasticsearch: "elasticsearch:elasticsearch"
  3. Add, commit, and push code changes.

    git add -A && git commit -m "Enable Elasticsearch" && git push origin <branch-name>

    For information on how these changes affect your environments, see Services.

  4. Verify the relationships and configure Elasticsearch in the Admin UI.

  5. Reindex the Catalog Search index.

     bin/magento indexer:reindex catalogsearch_fulltext
  6. Clean the cache.

     bin/magento cache:clean

Add Elasticsearch plugins

Optionally, you can add plugins with the .magento/services.yaml file. For example, to enable the ICU analysis plugin and Python script support plugin, add the configuration:plugins section with the listed plugin codes:

    type: elasticsearch:5.2
    disk: 1024
            - analysis-icu
            - lang-python

The following are supported Elasticsearch plugins for version 2.4:

  • analysis-icu: ICU Analysis Plugin, Support ICU Unicode text analysis
  • analysis-kuromoji: Japanese (kuromoji) Analysis Plugin, Japanese language support
  • analysis-phonetic: Phonetic Analysis Plugin, Phonetic analysis
  • analysis-smartcn: Smart Chinese Analysis Plugins
  • analysis-stempel: Stempel Polish Analysis Plugin
  • cloud-aws: AWS Cloud Plugin, allows storing indices on AWS S3
  • cloud-azure: Azure Cloud Plugin
  • cloud-gce: GCE Cloud Plugin
  • delete-by-query: Support for deleting documents matching a given query
  • discovery-multicast: Ability to form a cluster using TCP/IP multicast messages
  • lang-javascript: JavaScript language plugin, allows the use of JavaScript in Elasticsearch scripts
  • lang-python: Python language plugin, allows the use of Python in Elasticsearch scripts
  • mapper-attachments: Mapper attachments plugin for indexing common file types
  • mapper-murmur3: Murmur3 mapper plugin for computing hashes at index-time
  • mapper-size: Size mapper plugin, enables the _size meta field

See Elasticsearch plugin documentation.

If you use the ElasticSuite third-party plugin, you must update the ece-tools package to version 2002.0.19 or later.

If you need to restart the Elasticsearch service, you must contact Magento support.

Staging and Production environments that are in the same cluster share a single Elasticsearch instance, so you must specify a unique Elasticsearch prefix for each of these environments.