elasticsearch - ElasticHQ : Unable to Connect to Server! 收到状态码:0

标签 elasticsearch

当我尝试连接到 Elastic HQ 时出现以下错误。 elasticsearch 的本地实例正在运行。 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

浏览器控制台消息

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!

最佳答案

现在可以使用了!我必须在 elasticsearch.yml 中添加另一个条目

http.cors.allow-origin: "*"
http.cors.enabled: true 
node.master: true

关于elasticsearch - ElasticHQ : Unable to Connect to Server! 收到状态码:0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33722127/

相关文章:

elasticsearch - 或与elasticsearch查询

elasticsearch - 如何在elasticsearch查询中获得3个随机搜索结果

regex - 监控 http 响应内容正则表达式行为

elasticsearch - 使用来自具有不同包结构的 2 个不同应用程序的相同 Elastic Index 来存储数据(HibernateSearch + Elastic)

elasticsearch - ElasticSearch Security恐惧许可证?

search - 如何定期删除 Elasticsearch 索引?

elasticsearch - ElasticSearch在单个索引中具有相同映射的多种类型

elasticsearch - Elasticsearch如何匹配字段 token 是查询 token 的子集的文档

elasticsearch - 为什么在尝试连接到Elasticsearch时Elasticsearch2适配器给出 'cannot connect to any node'

ruby-on-rails - Rails 4链接以使用Elasticsearch搜索