我已经沉浸在 Elastic Search 中 2 个小时了。我用 Marvel 成功安装了 ES(使用marvel.agent.enabled: false
在 config/elasticsearch.yml 中)并且能够从 Sense 发出成功的请求。我重新启动了我的开发机器,现在当我在 Sense 上发出以下请求时,它会响应:
Request failed to get to the server (status code: 0):
Elasticsearch may not be reachable or you may need to check your CORS settings.If CORS is enabled, try turning off Sense's Basic Authentication support under Setting (cog icon).This will result in a less strict CORS enforcement by the browser.
Please check the marvel documentation for more information.
Request(source http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_indexing_employee_documents.html):
PUT /megacorp/employee/1
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
按照指示,我通过在curl上发出类似的请求来检查ES是否可以访问:
Request:
curl -XPUT http://localhost:9200/megacorp/employee/100 -d '{ "first_name" : "test" }'
回复:
{"_index":"megacorp","_type":"employee","_id":"100","_version":1,"created":true}
这让我认为 ES 是可用的。
继续进行下一个检查“您可能需要检查您的 CORS 设置。”。我基于以下配置添加到elasticsearch.yml(并重新启动ES)这个建议 http://www.elasticsearch.org/guide/en/marvel/current/configuration.html#cors:
http.cors.enabled: true
http.cors.allow-origin: /.*/
http.cors.allow-credentials: true
但行为没有改变。
在 Marvel/Smart 设置中切换“支持基本身份验证”也没有影响。
欢迎任何有关可能出现问题的指示。