报错详细内容:
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.
解决办法:
打开 vendor/yiisoft/yii2-elasticsearch/Connection.php
183行左右找到代码
foreach ($nodes as $key => &$node) {
if (!isset($node['http_address'])) {
unset($nodes[$key]);
}
// Protocol is not a standard ES node property, so we add it manually
$node['protocol'] = $this->defaultProtocol;
}
修改为如下代码
foreach ($nodes as $key => &$node) {
if (!isset($node['http_address'])) {
// unset($nodes[$key]);
}
$node['http_address'] = $node['http']['publish_address'];
// Protocol is not a standard ES node property, so we add it manually
$node['protocol'] = $this->defaultProtocol;
}