Couldnt connect to host ElasticSearch down?

Hi All,

I face a problem to insert data into ElasticsSearch sometimes and i catch the exception is "Couldnt connect to host[ip address] , ElasticSearch down?". I am using ElasticSearch version is "1.7.5". and i am using php ElasticSearch client

cluster detail is 1 master node and 3 data node.
Master node ( 4 cpu, 13G Ram, 8G used Ram )
Data node 1 ( 4 cpu, 27G Ram, 25G used Ram )
Data node 2 ( 4 cpu, 27G Ram, 26G used Ram )
Data node 3 ( 4 cpu, 27G Ram, 26G used Ram )

Please help me out from this problem.

Can you paste the exception message, the relevant initialization code of your PHP client, and the addresses of your nodes?

First of all thanks for reply.

$attribute=array("35411" => "2016-07-19T00:04:23", "35413" => "2016-07-19T00:04:23");

try {
$ElasticSearchConnection = \ElasticSearch\Client::connection(array( 'servers' => 127.0.0.1, 'protocol' => 'http', 'type' => 'typeName', 'index' => 'indexName'));
$ElasticSearchConnection->index($attribute, 1);
} catch (Exception $ex) {
print_r($ex->getMessage());
}

exception message is Couldnt connect to host [127.0.0.1], ElasticSearch down?

Please provide the best solution

Can you confirm Elasticsearch is running locally? What's the output of:

curl -XGET 127.0.0.1:9200

Maybe you need to specify the port in the 'servers' parameter? Perhaps open an issue with the author of your client and ask there?

Actually i am using cluster on production but sometime its through exception "Couldnt connect to host , ElasticSearch down?"

I get message from RabbitMq Queue and then insert it into ElasticSearch but 5 % document not insert into ElasticSearch.

All ports are open.

Do you have some logs from your production cluster? Can you reach the cluster via curl when the client is reporting failures?

The error sounds pretty explicit: it cannot connect to your cluster. So there's either a temporary network event which is preventing the client from connecting, or something on the cluster which is preventing connections (such as long-running GCs). Or potentially because the node it is trying to talk down has gone down for some reason.