ElasticHQ:无法连接到服务器!收到状态码:0

Sel*_*sra 18 elasticsearch

当我试图连接到Elastic HQ时,我遇到了错误.elasticsearch的本地实例正在运行.弹性搜索版本是2.0.0.

在elasticsearch.yml中,http.cors.enabled:设置为true

收到以下错误:

ElasticHQ:无法连接到服务器!收到的状态代码:0.状态代码为0,可能意味着主机无法缓存或者没有正在侦听给定端口.你启用了CORS吗?

我错过了什么吗?

Elasticsearch配置

    # ---------------------------------- Network -----------------------------------
    #
    # Set the bind adress to a specific IP (IPv4 or IPv6):
    #
    network.host: 127.0.0.1
    #
    # Set a custom port for HTTP:
    #
    http.port: 9200

    http.cors.enabled: true
Run Code Online (Sandbox Code Playgroud)

浏览器控制台消息

The browser console says 

Inside ErrorMessage
all.min.js:12 http://127.0.0.1:9200
all.min.js:12 Inside ClusterHealth
all.min.js:12 Inside ClusterState
all.min.js:12 Inside IndexStatsModel
all.min.js:12 Inside NodeList
index.html:1 XMLHttpRequest cannot load http://127.0.0.1:9200/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
all.min.js:12 Failed to Connect on Ping!
Run Code Online (Sandbox Code Playgroud)

Sel*_*sra 41

它现在有效!我必须在elasticsearch.yml中添加另一个条目

http.cors.allow-origin: "*"
http.cors.enabled: true 
node.master: true
Run Code Online (Sandbox Code Playgroud)

  • 根据我的Collegue @ Sumit的要求,完整的配置集就在这里.所以你不必阅读整个线程`http.cors.enabled:true``http.cors.allow-origin:"*"``node.master:true` (2认同)