作者:xao | 来源:互联网 | 2024-11-08 15:16
在安装并配置了Elasticsearch后,我在尝试通过GET/_nodes请求获取节点信息时遇到了问题,收到了错误消息。为了确保请求的正确性和安全性,我需要进一步排查配置和网络设置,以确保Elasticsearch集群能够正常响应。此外,还需要检查安全设置,如防火墙规则和认证机制,以防止未经授权的访问。
我安装了elasticsearch并尝试发出请求,但作为响应,我收到了错误消息
Cluster autodetection did not find any active node. Make sure a GET /_nodes reguest on the hosts defined in the config returns the "http_address" field for each node.
当我运行命令CURL -X GET http://localhost:9200
时
{
"name" : "DS12IC4","cluster_name" : "elasticsearch_denysmaksiura","cluster_uuid" : "YzFUXRS6SPmObJcC4bv_ag","version" : {
"number" : "6.8.5","build_flavor" : "oss","build_type" : "tar","build_hash" : "78990e9","build_date" : "2019-11-13T20:04:24.100411Z","build_snapshot" : false,"lucene_version" : "7.7.2","minimum_wire_compatibility_version" : "5.6.0","minimum_index_compatibility_version" : "5.0.0"
},"tagline" : "You Know,for Search"
}
我的main.php文件
'elasticsearch' => [
'class' => 'yii\elasticsearch\Connection','nodes' => [
['http_address' => 'localhost:9200'],// configure more hosts if you have a cluster
],],
我的控制器
$model = new SearchAllForms();
$dataProvider = $model->globalSearch(Yii::$app->request->queryParams);
echo"";
var_dump($dataProvider->getModels());
exit;
我的模型(测试请求)
$query = $this::find();
$dataProvider = new activeDataProvider([
'query' => $query,'key' => 'id'
]);
$query->query(['match' => ['name' => 'Гидротест']]);
return $dataProvider;
如何清除此错误?
yiisoft / yii2-elasticsearch中提供了2.1-dev版本。该问题已解决。请检查此版本。