I installed ElasticSearch on my Ubuntu server and it seems to be working correctly when I do the cURL command. However, when I use the ElasticSearch URI using Ajax I get the following error: net::ERR_BLOCKED_BY_CLIENT
Here's how my Ajax request looks like:
const QUERY_URL = "http://localhost:9200/topics/_search?q=name:" + QUERY
+ "*&sort=follower_count:desc&size=5";
$.ajax({
type: 'GET',
url: QUERY_URL,
success: function (data) {
console.log(data);
},
error: function (xhr) {
if (xhr.status === 0) {
showSnackBarMessage("Can't communicate with server");
}
}
});
I tried using POST
instead of GET
. I also tried changing localhost to its I.P equivalent. However, nothing seems to be working. I keep on getting the same error. Is there a way to solve this without opening my ElasticSearch API to the world?