Php client can't connect to different port localhost

I've installed last ElasticSearch version (2.2.0) to my vagrant, ant forwarded ports like 62000 host goes to 9200 guest, and everything works fine, localhost:62000 on my host machine returns me default information about ES, after setting CORS to enabled and node set as master, even my ElasticHQ now easily connects to it, but. But Elastic'a throws exception Couldn't connect to host, Elasticsearch down?

My test php code is:

$client = new Client([
    'host' => 'localhost',
    'port' => 62000
$index = $client->getIndex('test');
$index->create(array(), true);
$type = $index->getType('test');
$type->addDocument(new Document(1, array('username' => 'ruflin')));

$query = array(
    'query' => array(
        'query_string' => array(
            'query' => 'ruflin',

$path = $index->getName() . '/' . $type->getName() . '/_search';

$response = $client->request($path, Request::GET, $query);
$responseArray = $response->getData();

I've also tried instead of localhost, but no luck.


Tried native elasticsearch php client as:

$hosts = [
$client = Elasticsearch\ClientBuilder::create()->setHosts($hosts)->build();

Getting Uncaught Elasticsearch\Common\Exceptions\NoNodesAvailableException: No alive nodes found in your cluster

elasticsearch.yml edits:

node.master: true _non_loopback_
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"

What am i doing wrong?

If i change _non_loopback_


i can connect to ES like this

$hosts = [
$client = Elasticsearch\ClientBuilder::create()->setHosts($hosts)->build();

but cannot reach it via 62000 port