Ajax Query Format With Elasticsearch
I am trying to make a post request with AJAX to my elasticsearch index. The cURL result is: [~]$ curl -XGET 'http://localhost:9200/firebase/_search?q=song:i%20am%20in' {'took':172
Solution 1:
Change the method to GET
and dateType to json
. Also the querystring requires a q
parameter.
var data = {
'q': 'song:' + $('#message').val()
};
$.ajax({
type: "GET",
url: "http://localhost:9200/firebase/_search",
contentType: 'application/json',
data: JSON.stringify(data),
success: searchSuccess,
dataType: 'json'
});
Post a Comment for "Ajax Query Format With Elasticsearch"