Closed tjrobinson closed 7 years ago
Looking in the Chrome console I see that:
username: "127.0.0.1", password: "9200"
Hey @tjrobinson It looks like CORS error, your allow origin should be like this
http.cors.allow-origin: "*"
Steps: 1) Stop elasticsearch 2) update config Es config:
http.cors.allow-origin: "*"
http.cors.enabled: true
http.cors.allow-headers : "X-Requested-With, X-Auth-Token, Content-Type, Content-Length, Authorization"
http.cors.allow-methods: "OPTIONS, HEAD, GET, POST, PUT, DELETE"
http.cors.allow-credentials: true
3) start elasticsearch
4) Open console and try to make a request.
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://localhost:9200/_search', true);
xhr.withCredentials = true;
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', 'Basic ' + btoa('test:test'));
xhr.send('{"query":{"match_all":{}}}');
If it's response status is 200 then try with mirage, mirage should work after that. If you are facing any error in request post the error log over here or checkout CORS issue for elasticsearch
I've done that and Mirage is still giving the same error.
Using the Chrome console I get this:
I think the problem is that we have no authentiction set up on our ES instances, but Mirage and your script above send credentials?
I just confirmed, mirage chrome extension is working fine with local connection. and yes it was my mistake in above steps.
Es config should be:
http.cors.enabled: true
http.cors.allow-origin: "/.*/"
http.cors.allow-credentials: true
http.cors.allow-headers: "Authorization, X-Requested-With, Content-Type, Content-Length"
and still if you see the issue, please provide detail of es version.
Thanks. It's looking better but I'm still getting an error. I'm on Elasticsearch 2.3.4 on Windows 10 (can't upgrade currently as I need to match what we're running in production):
This is little bit confusing, I cannot see any error message in console log. Still you are getting error on UI this is strange. Can you just try disconnecting and connecting?
and can you also try on gh-pages? appbaseio.github.io/mirage
I've sorted it. I was connecting to the index via the alias not the actual index name. It works if I use the index name. Not sure if that's a bug or just me doing it wrong?
GET /_cat/aliases?v
alias index filter routing.index routing.search
empactis_local_bluesky empactis_local_blueskyv5 - - -
I see the same issue (and solution) with the gh-pages version and the plugin too.
@tjrobinson yes, so mirage is not creating anything for you. it is just an query explorer.
you can create indexes and view data using dejavu.
The index and the alias exist already. I was expecting to be able to use either the alias or the index name when querying.
Okay, I will check it out if we can support alias also for connection.
Great, thanks. Nice tools by the way, good work.
Anyone else stuck on this, I had to add the options to the elastic config, restart, and then use 127.0.0.1
instead of localhost
to be able to connect to my local instance.
I've installed the latest Chrome extension from the Chrome store.
When I connect to
http://127.0.0.1:9200
orhttp://localhost:9200
it fails with:I've added this to my elasticsearch.yml file and restarted before doing the above: