如果您的 Kibana 和 ES 安装在同一个盒子上,您可以通过在 Kibana 的 config.js 文件中使用以下行让它自动检测 ES URL/IP:
/** @scratch /configuration/config.js/5
* ==== elasticsearch
*
* The URL to your elasticsearch server. You almost certainly don't
* want +http://localhost:9200+ here. Even if Kibana and Elasticsearch are on
* the same host. By default this will attempt to reach ES at the same host you have
* elasticsearch installed on. You probably want to set it to the FQDN of your
* elasticsearch host
*/
elasticsearch: "http://"+window.location.hostname+":9200",
这是因为 Kibana 和 ES 之间的接口是通过 JavaScript 进行的,因此使用127.0.0.1或localhost实际上指向客户端机器(浏览器正在运行)而不是服务器。