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 version 5.2 and 6.x (supported by Magento version 2.3.1 and later).

You can use the following instructions for service setup on Magento Commerce Cloud Pro Integration environments and Starter environments, including master branch. You must submit a support ticket to configure the service on Pro Production and Staging environments. See Services.

To enable Elasticsearch:

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

    1
    2
    3
    
    elasticsearch:
        type: elasticsearch:6.5
        disk: 1024
    
  2. Set the relationships property in the .magento.app.yaml file.

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

    1
    
    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.

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

    1
    
     bin/magento cache:clean
    

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:

1
2
3
4
5
6
7
elasticsearch:
    type: elasticsearch:6.5
    disk: 1024
    configuration:
        plugins:
            - analysis-icu
            - lang-python

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.