I have run this command:

composer show elasticsearch/elasticsearch

then all stats of elastic search runs perfectly. Attached is the screenshot. Also, I have configured in the admin panel. The screenshot attached as well then why my connection always failed. Please fix this solution & alive cluster found error comes in your cluster.

enter image description here

enter image description here

  • elastic search will not work on localhost
    – Pramod
    Commented Aug 31, 2020 at 8:52
  • so what do I have to change? Commented Aug 31, 2020 at 8:52
  • I am running my website on cpanel online. Commented Aug 31, 2020 at 8:52
  • try to switch it back to elastic search 6 or may be deafult coz sql search has been deprecated
    – Pramod
    Commented Aug 31, 2020 at 8:53
  • What do I change in Elastic search & Elastic serach hostname Commented Aug 31, 2020 at 8:54

2 Answers 2


I was also facing same issue, I have installed Elasticsearch in my Linux Mint & It's working fine. Here is the steps.

Run the below command to Install Elasticsearch In locally.

Download and install the public signing key :

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

Installing from the APT repositoryedit

You may need to install the apt-transport-https package on Debian before proceeding :

sudo apt-get install apt-transport-https

Save the repository definition to /etc/apt/sources.list.d/elastic-7.x.list :

echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list

You can install the Elasticsearch Debian package with :

sudo apt-get update && sudo apt-get install elasticsearch

Elasticsearch is not started automatically after installation. How to start and stop Elasticsearch depends on whether your system uses SysV init or systemd (used by newer distributions).

ps -p 1

Running Elasticsearch with SysV init : Use the update-rc.d command to configure Elasticsearch to start automatically when the system boots up :

sudo update-rc.d elasticsearch defaults 95 10

Elasticsearch can be started and stopped using the service command :

sudo -i service elasticsearch start

sudo -i service elasticsearch stop

Configure Apache and Elasticsearch : Set up a proxy (Set up a proxy for Apache 2.4)

Enable mod_proxy as follows :

a2enmod proxy_http or sudo a2enmod proxy_http

Use a text editor to open /etc/apache2/sites-available/000-default.conf

Add the following directive at the top of the file :

Listen 8080

Add the following at the bottom of the file :

<VirtualHost *:8080>
    ProxyPass "/" "http://localhost:9200/"
    ProxyPassReverse "/" "http://localhost:9200/"

Restart Apache :

service apache2 restart or sudo service apache2 restart

Verify the proxy works by entering the following command :

For example, if your proxy uses port 8080:

curl -i http://localhost:8080/_cluster/health

If curl request success then messages display like below :

HTTP/1.1 200 OK Date: Sun, 23 Aug 2020 06:05:56 GMT Server: Apache/2.4.18 (Ubuntu) content-type: application/json; charset=UTF-8 content-length: 389


Go to Admin Panel -> Stores -> Settings -> Configuration -> Catalog -> Catalog Search. Change the settings like below.

Search Engine : Search Engine7

Elasticsearch Server Hostname : localhost

Elasticsearch Server Port : 8080

Elasticsearch Index Prefix : magento2

Enable Elasticsearch HTTP Auth : No

Elasticsearch Server Timeout : 15

Now save the configuration & run below cache clean command.

php bin/magento cache:clean

Now click on Test Connection button.

After successful you will receive Successful! Test again? in Test Connection button.

Ref : Dev Docs & Elasticsearch

For More Click here

  • I am using on windows 10 & I have already a elastic field in my magento2 admin Commented Aug 31, 2020 at 8:57
  • Try Test Connection. Success or Fail ? Commented Aug 31, 2020 at 9:01
  • Is this link correct @ArunKumar Commented Aug 31, 2020 at 9:01
  • Connection failed on elasticsearch:internal and on localhost 9200 port test is failed as well Commented Aug 31, 2020 at 9:08
  • Have you added virtual host ? /etc/apache2/sites-available/000-default.conf in file ? Commented Aug 31, 2020 at 9:13

I was struggled yesterday with the exact same issue (No alive nodes found in your cluster) and I've figured it out.

I'm using Elasticsearch in a production setup, in a 3-node cluster. In order to be fully secured & to enable authentication, I've also followed (from the Elastic documentation) the steps to configure TLS communications between nodes & Kibana.

The fact is that I was using an auto-generated non-trusted CA file to sign all my cert & key files. But from the point of view of PHP (on Magento's side), this non-trusted CA file was silently causing Magento to refuse the connection to my Elastic cluster, even though my connection parameters were correct.

So I've added this CA file into the OS CA directory. I'm using Debian 10, to do this:

  1. Get the CA file (in PEM format) from the Elastic node where you generated all the certificates.
    • You must have run this command during your configuration :
    /usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
    • That command must have generated a ZIP file and in that and ZIP, there's a folder named kibana, this folder contains the right CA file format to copy to your Magento server.
    • Copy that elasticsearch-ca.pem file to your Magento server.
  2. From your Magento server, copy the elasticsearch-ca.pem into your /usr/local/share/ca-certificates/, but with a .crt file extension ! :
root@mgto2-server:~# cp elasticsearch-ca.pem /usr/local/share/ca-certificates/elasticsearch-ca.crt
  1. Now, update your available certificates using this command (Debian 10) :
root@mgto2-server:~# update-ca-certificates
Updating certificates in /etc/ssl/certs...
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

Note the 1 added here.

Finally restart Apache2 & PHP-FPM (if you're using PHP-FPM, of course ;-) ) and you should be able to initiate a successful HTTPS connection to your Elasticsearch instance from Magento.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.