【已解决】No alive nodes found in your cluster错误
php 集成Elasticsearch 时候,查询出现这个错,请检查配置的服务器IP是否正确,服务器是否开启。
需要指定节点的ip和端口号,示例代码如下:
setHosts($host)->build();
$params = [
‘index’ => ‘my_indextest’,
‘type’ => ‘my_type’,
‘id’ => ‘my_id’,
‘body’ => [‘testField’ => ‘blog.75271.com’]
];
$response = $client->index($params);
print_r($response);