Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ES reachable from curl but not from Marvel/Sense

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.

like image 751
Ram Avatar asked Feb 05 '15 21:02

Ram


1 Answers

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.

like image 83
akshay Avatar answered Oct 15 '22 00:10

akshay