Set up OpenSearch service

The OpenSearch service is an open-source fork of Elasticsearch 7.10.2, following the licensing changes for Elasticsearch. See System requirements for a list of supported versions.

Elasticsearch 7.11 and later is not supported for Adobe Commerce on cloud infrastructure. Adobe Commerce and Magento Open Source versions 2.4.4, 2.4.3-p2, and 2.3.7-p3 support the OpenSearch service. The on-premises installations continue to support Elasticsearch.

OpenSearch enables you to take data from any source, any format, and search and visualize it in real time.

  • 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

Use the following instructions for service setup on Adobe Commerce on cloud infrastructure Pro Integration environments and Starter environments, including the master branch.

You must submit a Support ticket to change the service configuration on Pro Production and Staging environments. See Services.

Adobe recommends that you always set up OpenSearch for your Adobe Commerce on cloud infrastructure project even if you plan to configure a third-party search tool for your Adobe Commerce application. Setting up OpenSearch provides a fallback option in the event that the third-party search tool fails.

Enable OpenSearch

To enable OpenSearch:

  1. For Starter projects and Pro Integration environments, add the opensearch service to the .magento/services.yaml file with the appropriate version and allocated disk space in MB.

        type: opensearch:<version>
        disk: 1024

    For Pro projects, you must submit a Adobe Commerce Support ticket to change the OpenSearch version in the Staging and Production environments.

  2. Set the relationships property in the file.

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

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

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

  4. Verify the service relationships and configure OpenSearch in the Admin UI.

  5. Reindex the Catalog Search index.

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

    bin/magento cache:clean

After initial service setup, you can change the software version for an installed service by updating the services.yaml and configuration files. See Change service version.

Add plugins for OpenSearch

You can add plugins to OpenSearch by adding the configuration:plugins section to the OpenSearch service in the .magento/services.yaml file. For example, the following code enables both the ICU and Phonetic analysis plugins.

```yaml opensearch: type: opensearch: disk: 1024 configuration: plugins: - analysis-icu - analysis-phonetic