I opened another post last week because my elastic search was not returning accurate results see, ElasticSearch post
Basically what was happening was that when I am using jsonp, the request is not actually being sent as a GET request instead of a POST request. Below is the jsonp request. When I use json, it actually gets sent as a POST.
amplify.request.define("searchPostRequest", "ajax", {
url: "http://leServer:9200/people/person/_search",
type: "POST",
dataType: 'jsonp',
contentType: 'application/json'
});
Anyone know how I can force jsonp to be sent as a POST request?
You can not make a JSONP call to a different domain or same domain with a POST since JSONP works by adding a script tag to the page. It is not making an XMLHttpRequest.
If you want to post data and it is the same domain, just make a normal POST ajax call to the server and return JSON.
If it is a cross domain call: If you control the other domain and you only care about modern day browsers you can use CORS, If not, you would have to use a proxy on your server to make the post request. Both of these solutions would also be making a JSON call, not JSONP.