ES可以从卷曲而不是来自Marvel / Sense [英] ES reachable from curl but not from Marvel/Sense
问题描述
marvel.agent.enabled:false
),并且能够从Sense获得成功的请求。我重新启动了我的开发机器,现在当我在Sense上提出以下请求时,它响应: 请求无法访问服务器(状态码:0):
Elasticsearch可能无法访问,或者您可能需要检查您的CORS设置。如果启用CORS,请尝试关闭设置(cog图标)下的Sense的基本身份验证支持。将导致浏览器执行的CORS不太严格。
请查看奇迹文档以获取更多信息。
请求(源):
PUT / megacorp / employee / 1
{
first_name:John,
last_name:Smith,
age:25,
about:我喜欢攀岩,
兴趣:[运动,音乐]
}
按照指示,我通过在卷曲上发出类似的请求来检查ES是否可达:
请求:
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) a>:
http.cors.enabled:true
http.cors.allow-origin:/.*/
http.cors.allow-credentials:true
但行为没有变化。
在Marvel / Smart设置中切换支持基本身份验证也没有影响。
欢迎任何指针
尝试在另一个浏览器或私人/隐身模式下运行奇迹/感觉html页面。我有同样的问题,这样做解决了。我认为这是由于设置存储在cookie或一些不太确定。
I am in the 2 hour of my Elastic Search immersion. I successfully installed ES with Marvel (with marvel.agent.enabled: false
in config/elasticsearch.yml) and was able to make successful requests from Sense. I restarted my development machine and now when I make the following request on Sense, it responds:
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):
PUT /megacorp/employee/1
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
As directed, I checked if ES is reachable by making a similar request on curl:
Request:
curl -XPUT http://localhost:9200/megacorp/employee/100 -d '{ "first_name" : "test" }'
Response:
{"_index":"megacorp","_type":"employee","_id":"100","_version":1,"created":true}
This leads me to think that ES is available.
Moving on to the next check "you may need to check your CORS settings.". I added the following configuration to elasticsearch.yml (and restarted ES) based on this recommendation:
http.cors.enabled: true
http.cors.allow-origin: /.*/
http.cors.allow-credentials: true
But there is no change in behaviour.
Toggling "Support Basic Auth" in Marvel/Smart settings has no impact either.
Welcome any pointers on what could be going wrong.
Try running the marvel/sense html page on another browser or in private/incognito mode. I had the same problem and doing this solved it. I think it is due to the settings being stored on cookie or something not really sure.
这篇关于ES可以从卷曲而不是来自Marvel / Sense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!