# Bug or feature? different results when querying using -d '{}' and ?q=

**URL:** <https://discuss.elastic.co/t/bug-or-feature-different-results-when-querying-using-d-and-q/5705>\
**Category:** Elasticsearch\
**Created:** [October 27, 2011, 1:33pm UTC](https://discuss.elastic.co/t/bug-or-feature-different-results-when-querying-using-d-and-q/5705 "2011-10-27T13:33:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matyas\_Rak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matyas_rak/32/3097_2.png) [@Matyas\_Rak](https://discuss.elastic.co/u/Matyas_Rak)\
**Post date:** [October 27, 2011, 1:33pm UTC](https://discuss.elastic.co/t/bug-or-feature-different-results-when-querying-using-d-and-q/5705/1 "2011-10-27T13:33:34Z")

</div>

Hi,  
I am noticing strange behaviour on my elastic search installation. I'm  
using couchdb river and the following query:

curl -XGET [http://localhost:9200/product\_test/product\_test/\_search](http://localhost:9200/product_test/product_test/_search) -d  
'  
{  
"query": {  
"term": {  
"firstName": "Lorem"  
}  
}  
}'

returns 0 results:  
{"took":5,"timed\_out":false,"\_shards":{"total":5,"successful":  
5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":[]}}

While the request:  
curl -XGET [http://localhost:9200/product\_test/product\_test/\_search?q=firstName:Lorem](http://localhost:9200/product_test/product_test/_search?q=firstName:Lorem)

returns expected result:  
{  
"took" : 2,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 0.13424811,  
"hits" : [ {  
"\_index" : "product\_test",  
"\_type" : "product\_test",  
"\_id" : "e66fe7d98b65e41d97059538f5019644",  
"\_score" : 0.13424811, "\_source" :  
{"\_rev":"1-6ace531ad6ce61f232c4b0931bb83671","call":  
{"phone":"123456"},"form":{"lastName":"Lorem ipsum dolor sit amet,  
consectetur adipiscing elit. Fusce eget tellus venenatis enim interdum  
malesuada at a nibh. Proin tempor pretium aliquet. Integer dui mi,  
placerat ut vulputate quis, imperdiet quis arcu. Donec elementum  
faucibus nunc, et ultricies nisi eleifend id. Fusce euismod felis  
ullamcorper quam feugiat rutrum. Nunc ornare ultricies lectus, nec  
ultrices velit viverra ut. Vivamus accumsan porta lorem, at pretium  
ipsum sagittis in. Fusce sem eros, pretium non convallis id, elementum  
quis nisl. Ut nisl lacus, luctus id iaculis quis, malesuada eu  
arcu.","firstName":"Lorem ipsum dolor sit  
amet"},"\_id":"e66fe7d98b65e41d97059538f5019644","meta":  
{"assigned":"johnDoe"}}  
} ]  
}  
}

What makes it even stranger is that when I pass the search in  
lowercase, it works:  
{  
"query": {  
"term": {  
"firstName": "Lorem"  
}  
}  
}

I haven't seen much info about this in the doc. What I want, is to  
perform search only in those documents, which have been assigned to  
certain user (property with a certain value) and I need this to be  
case sensitive...

I'm using elasticsearch 0.17.9

Thanks for pointing me to the right docs 🙂

Matyas

---

<div class="post-metadata">

**Author:** ![Matyas\_Rak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matyas_rak/32/3097_2.png) [@Matyas\_Rak](https://discuss.elastic.co/u/Matyas_Rak)\
**Post date:** [October 27, 2011, 1:38pm UTC](https://discuss.elastic.co/t/bug-or-feature-different-results-when-querying-using-d-and-q/5705/2 "2011-10-27T13:38:43Z")

</div>

By passing it in lowercase, i meant:

{  
"query": {  
"term": {  
"firstName": "lorem"  
}  
}  
}

A typo in my first post

Matyas

On 27 říj, 15:33, Matyas Rak [cra...@gmail.com](mailto:cra...@gmail.com) wrote:

> Hi,  
> I am noticing strange behaviour on my Elasticsearch installation. I'm  
> using couchdb river and the following query:
> 
> curl -XGEThttp://localhost:9200/product\_test/product\_test/\_search-d  
> '  
> {  
> "query": {  
> "term": {  
> "firstName": "Lorem"  
> }  
> }
> 
> }'
> 
> returns 0 results:  
> {"took":5,"timed\_out":false,"\_shards":{"total":5,"successful":  
> 5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}
> 
> While the request:  
> curl -XGEThttp://localhost:9200/product\_test/product\_test/\_search?q=firstName:L...
> 
> returns expected result:  
> {  
> "took" : 2,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1,  
> "max\_score" : 0.13424811,  
> "hits" : [ {  
> "\_index" : "product\_test",  
> "\_type" : "product\_test",  
> "\_id" : "e66fe7d98b65e41d97059538f5019644",  
> "\_score" : 0.13424811, "\_source" :  
> {"\_rev":"1-6ace531ad6ce61f232c4b0931bb83671","call":  
> {"phone":"123456"},"form":{"lastName":"Lorem ipsum dolor sit amet,  
> consectetur adipiscing elit. Fusce eget tellus venenatis enim interdum  
> malesuada at a nibh. Proin tempor pretium aliquet. Integer dui mi,  
> placerat ut vulputate quis, imperdiet quis arcu. Donec elementum  
> faucibus nunc, et ultricies nisi eleifend id. Fusce euismod felis  
> ullamcorper quam feugiat rutrum. Nunc ornare ultricies lectus, nec  
> ultrices velit viverra ut. Vivamus accumsan porta lorem, at pretium  
> ipsum sagittis in. Fusce sem eros, pretium non convallis id, elementum  
> quis nisl. Ut nisl lacus, luctus id iaculis quis, malesuada eu  
> arcu.","firstName":"Lorem ipsum dolor sit  
> amet"},"\_id":"e66fe7d98b65e41d97059538f5019644","meta":  
> {"assigned":"johnDoe"}}  
> } ]  
> }
> 
> }
> 
> What makes it even stranger is that when I pass the search in  
> lowercase, it works:  
> {  
> "query": {  
> "term": {  
> "firstName": "Lorem"  
> }  
> }
> 
> }
> 
> I haven't seen much info about this in the doc. What I want, is to  
> perform search only in those documents, which have been assigned to  
> certain user (property with a certain value) and I need this to be  
> case sensitive...
> 
> I'm using elasticsearch 0.17.9
> 
> Thanks for pointing me to the right docs 🙂
> 
> Matyas

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 27, 2011, 6:24pm UTC](https://discuss.elastic.co/t/bug-or-feature-different-results-when-querying-using-d-and-q/5705/3 "2011-10-27T18:24:09Z")

</div>

Using q= in the URI ends up being translated to a query\_string query, not a  
term query. The query\_string query analyzes the text you provide to search.

On Thu, Oct 27, 2011 at 3:38 PM, Matyas Rak [crabcz@gmail.com](mailto:crabcz@gmail.com) wrote:

> By passing it in lowercase, i meant:
> 
> {  
> "query": {  
> "term": {  
> "firstName": "lorem"  
> }  
> }  
> }
> 
> A typo in my first post
> 
> Matyas
> 
> On 27 říj, 15:33, Matyas Rak [cra...@gmail.com](mailto:cra...@gmail.com) wrote:
> 
> > Hi,  
> > I am noticing strange behaviour on my Elasticsearch installation. I'm  
> > using couchdb river and the following query:
> > 
> > curl -XGEThttp://localhost:9200/product\_test/product\_test/\_search-d  
> > '  
> > {  
> > "query": {  
> > "term": {  
> > "firstName": "Lorem"  
> > }  
> > }
> > 
> > }'
> > 
> > returns 0 results:  
> > {"took":5,"timed\_out":false,"\_shards":{"total":5,"successful":  
> > 5,"failed":0},"hits":{"total":0,"max\_score":null,"hits":}}
> > 
> > While the request:  
> > curl  
> > -XGEThttp://localhost:9200/product\_test/product\_test/\_search?q=firstName:L...
> > 
> > returns expected result:  
> > {  
> > "took" : 2,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 1,  
> > "max\_score" : 0.13424811,  
> > "hits" : [ {  
> > "\_index" : "product\_test",  
> > "\_type" : "product\_test",  
> > "\_id" : "e66fe7d98b65e41d97059538f5019644",  
> > "\_score" : 0.13424811, "\_source" :  
> > {"\_rev":"1-6ace531ad6ce61f232c4b0931bb83671","call":  
> > {"phone":"123456"},"form":{"lastName":"Lorem ipsum dolor sit amet,  
> > consectetur adipiscing elit. Fusce eget tellus venenatis enim interdum  
> > malesuada at a nibh. Proin tempor pretium aliquet. Integer dui mi,  
> > placerat ut vulputate quis, imperdiet quis arcu. Donec elementum  
> > faucibus nunc, et ultricies nisi eleifend id. Fusce euismod felis  
> > ullamcorper quam feugiat rutrum. Nunc ornare ultricies lectus, nec  
> > ultrices velit viverra ut. Vivamus accumsan porta lorem, at pretium  
> > ipsum sagittis in. Fusce sem eros, pretium non convallis id, elementum  
> > quis nisl. Ut nisl lacus, luctus id iaculis quis, malesuada eu  
> > arcu.","firstName":"Lorem ipsum dolor sit  
> > amet"},"\_id":"e66fe7d98b65e41d97059538f5019644","meta":  
> > {"assigned":"johnDoe"}}  
> > } ]  
> > }
> > 
> > }
> > 
> > What makes it even stranger is that when I pass the search in  
> > lowercase, it works:  
> > {  
> > "query": {  
> > "term": {  
> > "firstName": "Lorem"  
> > }  
> > }
> > 
> > }
> > 
> > I haven't seen much info about this in the doc. What I want, is to  
> > perform search only in those documents, which have been assigned to  
> > certain user (property with a certain value) and I need this to be  
> > case sensitive...
> > 
> > I'm using elasticsearch 0.17.9
> > 
> > Thanks for pointing me to the right docs 🙂
> > 
> > Matyas

---

<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:50am UTC](https://discuss.elastic.co/t/bug-or-feature-different-results-when-querying-using-d-and-q/5705/4 "2017-07-06T03:50:38Z")

</div>


