Installing Elastic Search Engine

If you would like to use our Magento 2 Elasticsearch Extension with Elasticsearch Engine, you should install it first.

Elastic Search should be installed differently in different platforms. If you use UNIX or Linux-based system, you can use one of the following commands:

  • cat /etc/*-release
  • cat /proc/version
  • hostnamectl

Note

Important Note: Elastic Search requires Java, so make sure openJDK or Oracle JDK is installed before proceed.

Depending on your platform, displayed by command above, you need to pick up one of the following procedures:

If you have unusual configuration, or use non-Linux setup, please, refer to official user manual how to install the elastic engine in such case.

After installation is complete, refer to How to check and manage Elastic Search Service subsection.

Ubuntu and other Debian-enabled OS

If you have installed Ubuntu, or other system with Debian package manager, execute the following commands:

  • wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.deb
  • wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.deb.sha512
  • shasum -a 512 -c elasticsearch-6.2.2.deb.sha512
  • sudo dpkg -i elasticsearch-6.2.2.deb
  • sudo update-rc.d elasticsearch defaults 95 10
  • sudo -i service elasticsearch start

CentOS and other RPM-enabled OS

If you have installed CentOS, or other system with RPM package manager, execute the following commands:

  • wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.1.rpm
  • wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.1.rpm.sha512
  • shasum -a 512 -c elasticsearch-6.1.1.rpm.sha512
  • sudo rpm --install elasticsearch-6.1.1.rpm
  • sudo chkconfig --add elasticsearch
  • sudo -i service elasticsearch start

Install from gzip package

If you have Linux-based system, but not from above distributions, or you just wish to make it run on-demand, use the following commands:

  • wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz
  • wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz.sha512
  • shasum -a 512 -c elasticsearch-6.2.2.tar.gz.sha512
  • tar -xzf elasticsearch-6.2.2.tar.gz
  • cd elasticsearch-6.2.2/
  • ./bin/elasticsearch

How to check and manage Elastic Search Service

Once you had installed Elastic Search using one of above procedures, you need to check, whether it actually installed and running. Use this command to get current status:

  • sudo -i service elasticsearch status

Output should return: elasticsearch is running

You can also visit Stores -> Configuration -> Mirasvit Extensions -> Search -> Search Engine Configuration, then select Elasticsearch Engine at Search Engine option.

You will see a Check status button on displayed subpanel. If Elastic Search is properly installed, you will receive output like below:

Example

Elasticsearch is running.

name: nyYUXv5
cluster_name: elasticsearch
cluster_uuid: EFGeuFOBSP64M9q0N8ST2Q
version:
     number: 6.2.2
     build_hash: 10b1edd
     build_date: 2018-02-16T19:01:30.685723Z
     build_snapshot:
     lucene_version: 7.2.1
     minimum_wire_compatibility_version: 5.6.0
     minimum_index_compatibility_version: 5.0.0
tagline: You Know, for Search
_shards:
     total: 0
     successful: 0
     failed: 0
_all:
     primaries:
     total:
indices:
{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","index_uuid":"_na_","index":"*"}],"type":"index_not_found_exception","reason":"no such index","index_uuid":"_na_","index":"*"},"status":404}

You can also send a request to your store's Elastic Search Port (see Connecting Elastic Search Engine). By default it is 9200. If Elastic Search is properly installed, you will receive the following output:

Example

URL: http://store.com:9200/

{
  "name" : "nyYUXv5",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "EFGeuFOBSP64M9q0N8ST2Q",
  "version" : {
    "number" : "6.2.2",
    "build_hash" : "10b1edd",
    "build_date" : "2018-02-16T19:01:30.685723Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

If at least one of the tests above passed with correct output, you had successfully installed Elastic Search Engine on your store.

If you need to manually restart Elastic Search, use command sudo -i service elasticsearch restart.

If you need to manually stop Elastic Search, use command sudo -i service elasticsearch stop.