Set up the 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 catalog
  • Elasticsearch analyzers support multiple languages
  • Supports stop words and synonyms
  • Indexing does not impact customers until reindex is completed

We support Elasticsearch version 1.4.

This feature is supported in Magento 2.1 only. Elasticsearch is supported in Magento 2.1.

More information about Elasticsearch.

If you’re upgrading to Magento Enterprise Cloud Edition 2.1.3, you must change your configuration as discussed in the 2.1.3 Release Notes.

Relationship

The format exposed in the $MAGENTO_CLOUD_RELATIONSHIPS follows:

"elasticsearch" : [
      {
         "host" : "elasticsearch.internal",
         "ip" : "250.0.97.96",
         "scheme" : "http",
         "port" : "9200"
      }
   ],

Usage example

In your .magento/services.yaml:

elasticsearch:
   type: elasticsearch:1.4
   disk: 1024

In your .magento.app.yaml:

relationships:
    elasticsearch: "elasticsearch:elasticsearch"

You can use the preceding service in a configuration file of your application as follows:

if (isset($_ENV['MAGENTO_CLOUD_RELATIONSHIPS'])) {
  $relationships = json_decode(base64_decode($_ENV['MAGENTO_CLOUD_RELATIONSHIPS']), TRUE);

  foreach ($relationships['elasticsearch'] as $endpoint) {
    $container->setParameter('elasticsearch_host', $endpoint['host']);
    $container->setParameter('elasticsearch_port', $endpoint['port']);
  }
}