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 reindex is completed
We support Elasticsearch versions 1.4, 1.7, 2.4, and 5.2. The default version is 1.7. We support Elasticsearch for all environments starting with Magento Commerce (Cloud) 2.1 and later. Refer to Elasticsearch information to learn more. For Magento Commerce (Cloud) 2.0.X, you can use Solr.
- Elasticsearch 5.2 is only available for 2.2.3 and later.
- If you’re upgrading to Magento Commerce 2.1.3, you must change your configuration as discussed in the 2.1.3 Release Notes.
If you prefer using an existing search service, like Elasticsearch, instead of relying on Magento Commerce (Cloud) to create it for you, use the
SEARCH_CONFIGURATION environment variable to connect it to your site.
Add Elasticsearch in services.yaml and .magento.app.yaml
To enable Elasticsearch, add the following code with your installed version and allocated disk space in MB to
To configure the relationships for the environment variable, set a relationship in your
.magento.app.yaml in the Git branch. For example:
Merge and deploy the code to set the configurations for Elasticsearch. For information on how these changes affect your environments, see
Add Elasticsearch plugins
Optionally, you can add the plugins through the
.magento/services.yaml file. For example, to enable ICU analysis plugin and Python script support plugins, add the configuration plugins section with the listed plugin codes:
For example, if you are using Smile ElasticSuite, you should add the following plugins:
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-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
For full documentation on these plugins, see Elasticsearch plugin documentation.
Verify environment-related relationships
We use the Magento Commerce (Cloud) environment variable
$MAGENTO_CLOUD_RELATIONSHIPS, a JSON object, to retrieve environment-related relationships.
You will use this information to complete Elasticsearch configuration in the Admin Panel.
To verify this information used for configurations and settings:
- SSH into the Integration environment with Elasticsearch installed and configured.
Enter the following command to pretty-print connection information for Elasticsearch. You will use this information when configuring Elasticsearch through the Magento Admin.
php -r 'print_r(json_decode(base64_decode($_ENV["MAGENTO_CLOUD_RELATIONSHIPS"])));'
The response includes all relationships for services and configuration data for that environment. In the response, you will locate data similar to the following for Elasticsearch:
Configure Elasticsearch for your site
The last step is to configure Elasticsearch for your catalog search options through the Magento Admin. You will need the information from the variable
MAGENTO_CLOUD_RELATIONSHIPS. See Configure Magento to use Elasticsearch to complete your Admin configurations.
Staging and Production environments share a single Elasticsearch instance, so you must specify a unique Elasticsearch prefix for each of these environments.