# Query result with jQuery differs from cURL result

**URL:** <https://discuss.elastic.co/t/query-result-with-jquery-differs-from-curl-result/13057>\
**Category:** Elasticsearch\
**Created:** [August 3, 2013, 9:14pm UTC](https://discuss.elastic.co/t/query-result-with-jquery-differs-from-curl-result/13057 "2013-08-03T21:14:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oliver\_B\_Fischer](https://avatars.discourse-cdn.com/v4/letter/o/f04885/32.png) [@Oliver\_B\_Fischer](https://discuss.elastic.co/u/Oliver_B_Fischer)\
**Post date:** [August 3, 2013, 9:14pm UTC](https://discuss.elastic.co/t/query-result-with-jquery-differs-from-curl-result/13057/1 "2013-08-03T21:14:16Z")

</div>

Hi,

I try to send queries I tested successfully with cURL with jQuery to ES,  
but the result differs from the result with cURL.

After a Wireshark session I found out, that jQuery sends my query as URL  
parameters while cURL send the query as JSON in the body of the request  
as application/x-www-form-urlencoded.

Does someone know how to send a query via jQuery properly to ES?

Currently I call ES with jQuery with this statement

```
$.ajax({
     type:"GET",
     data: getServEventStream,
     dataType:"json",
     url:"http://localhost:9200/billingevents/server/_search",
     success:function (data) {
       // some magic...
     }
 });

```

Best,

Oliver

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 3, 2013, 9:33pm UTC](https://discuss.elastic.co/t/query-result-with-jquery-differs-from-curl-result/13057/2 "2013-08-03T21:33:18Z")

</div>

May be adding processData: false could help?  
Or using POST?

I did it like this a long time ago: [https://github.com/dadoonet/devoxxfr\_demo/blob/gh-pages/index.html#L592](https://github.com/dadoonet/devoxxfr_demo/blob/gh-pages/index.html#L592)

Hope this helps

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 3 août 2013 à 23:14, "Oliver B. Fischer" [mailsink@swe-blog.net](mailto:mailsink@swe-blog.net) a écrit :

Hi,

I try to send queries I tested successfully with cURL with jQuery to ES, but the result differs from the result with cURL.

After a Wireshark session I found out, that jQuery sends my query as URL parameters while cURL send the query as JSON in the body of the request as application/x-www-form-urlencoded.

Does someone know how to send a query via jQuery properly to ES?

Currently I call ES with jQuery with this statement

$.ajax({  
type:"GET",  
data: getServEventStream,  
dataType:"json",  
url:"[http://localhost:9200/billingevents/server/\_search](http://localhost:9200/billingevents/server/_search)",  
success:function (data) {  
// some magic...  
}  
});

Best,

Oliver

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Oliver\_B\_Fischer](https://avatars.discourse-cdn.com/v4/letter/o/f04885/32.png) [@Oliver\_B\_Fischer](https://discuss.elastic.co/u/Oliver_B_Fischer)\
**Post date:** [August 3, 2013, 10:32pm UTC](https://discuss.elastic.co/t/query-result-with-jquery-differs-from-curl-result/13057/3 "2013-08-03T22:32:03Z")

</div>

With processData : false and using POST: It works!

Thank you very much!

Best,

Oliver

Am 03.08.13 23:33, schrieb David Pilato:

> May be adding processData: false could help?  
> Or using POST?
> 
> I did it like this a long time ago:  
> [JUG Elasticsearch Twitter Demo](https://github.com/dadoonet/devoxxfr_demo/blob/gh-pages/index.html#L592)
> 
> Hope this helps

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:23am UTC](https://discuss.elastic.co/t/query-result-with-jquery-differs-from-curl-result/13057/4 "2017-07-06T02:23:07Z")

</div>


