# Problems with elastic search querying when using libcurl

**URL:** <https://discuss.elastic.co/t/problems-with-elastic-search-querying-when-using-libcurl/9598>\
**Category:** Elasticsearch\
**Created:** [November 7, 2012, 2:49pm UTC](https://discuss.elastic.co/t/problems-with-elastic-search-querying-when-using-libcurl/9598 "2012-11-07T14:49:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dinesh\_Sriram](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@Dinesh\_Sriram](https://discuss.elastic.co/u/Dinesh_Sriram)\
**Post date:** [November 7, 2012, 2:49pm UTC](https://discuss.elastic.co/t/problems-with-elastic-search-querying-when-using-libcurl/9598/1 "2012-11-07T14:49:35Z")

</div>

Hello All,  
I am using libcurl to retrieve my indexed results. I have problems  
with the following code.  
[http://pastebin.com/NgdTBTAb](http://pastebin.com/NgdTBTAb)

The same code with out "to" in the range query seems to work fine. [code  
here: [http://pastebin.com/DYi10upZ](http://pastebin.com/DYi10upZ)]  
I tried its curl variation (below) and it seemed to retrieve all the  
results.

curl -XGET [http://localhost:9202/\_all/\_search?pretty=true](http://localhost:9202/_all/_search?pretty=true) -d '{  
"size": 1000000,  
"query" : {  
"range" : {  
"snapshotTime" : {  
"from" : "2012-10-31T13:00:00",  
"to" : "2012-10-31T14:00:00"  
}  
}  
}  
}'

Is there something wrong with the way I am querying?  
In case if there is a better library (C/C++) that suits elastic search  
needs, do let me know.  
Thanks.

--

---

<div class="post-metadata">

**Author:** ![Dinesh\_Sriram](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@Dinesh\_Sriram](https://discuss.elastic.co/u/Dinesh_Sriram)\
**Post date:** [November 7, 2012, 2:50pm UTC](https://discuss.elastic.co/t/problems-with-elastic-search-querying-when-using-libcurl/9598/2 "2012-11-07T14:50:53Z")

</div>

By problems in the first code, I mean, I don't get any results back. The  
total\_hits remain 0. However, its curl version works fine retrieving all  
the results.

--

---

<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, 3:05am UTC](https://discuss.elastic.co/t/problems-with-elastic-search-querying-when-using-libcurl/9598/3 "2017-07-06T03:05:44Z")

</div>


