Couldnt connect to host ElasticSearch down?

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