1

I guess the question says it all, but the thing is that there are some anomalies here :|

When javascript tries to fetch the search results I get this error:

Firefox(Firebug):    
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:9200/index/type/_search. (Reason: CORS request failed).

Chrome:
POST http://localhost:9200/index/type/_search net::ERR_CONNECTION_REFUSED

This is a totally anticipated result, so I googled the solution and found it. So I added the following lines to the config:

http.cors.allow-origin: '*'
http.cors.enabled: true

And it kinda fixed the problem. Here's the strange part: The app is on a web server, which I access using, let's say, http://whateverdomain.com. So the origin of the javascript would be http://whateverdomain.com and not localhost, thus the problem. Well if that's the case, how come I can interact with elasticsearch, on the remote server, using Sense on my local machine? Isn't my global IP considered cross-origin???? It might be of importance to mention that in sense, i access the server using its IP.

1 Answer 1

1

The problem was that when I initialized elasticsearch-js, i used the default host, unchanged, which was localhost, and localhost on js means my local machine. Changing that to my domain solved the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.