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

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.

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.

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:<version>
        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 service 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
    

Restart the Elasticsearch service

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

Elasticsearch plugins

Optionally, you can add Elasticsearch plugins by adding the configuration:plugins section to the .magento/services.yaml file. For example, the following code enables the ICU analysis plugin and Python script support plugins.

1
2
3
4
5
6
7
elasticsearch:
    type: elasticsearch:<service-version>
    disk: 1024
    configuration:
        plugins:
            - analysis-icu
            - lang-python

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