# Query returning wrong search result

**URL:** <https://discuss.elastic.co/t/query-returning-wrong-search-result/7768>\
**Category:** Elasticsearch\
**Created:** [May 18, 2012, 8:24pm UTC](https://discuss.elastic.co/t/query-returning-wrong-search-result/7768 "2012-05-18T20:24:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohit\_Anchlia](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Mohit\_Anchlia](https://discuss.elastic.co/u/Mohit_Anchlia)\
**Post date:** [May 18, 2012, 8:24pm UTC](https://discuss.elastic.co/t/query-returning-wrong-search-result/7768/1 "2012-05-18T20:24:19Z")

</div>

When I run search, whatever I give in the query string I am getting back  
that one doc which doesn't even match my results. Am I doing something  
wrong?

My Json parser seem to be putting double quotes around fields. Does  
elasticsearch expects double quotes in the query string? Something like  
q="base64":true?

[root@dslg2 ~]# curl -XGET '  
[http://dslg1:9200/attributes/one/\_search?q=base64:false1](http://dslg1:9200/attributes/one/_search?q=base64:false1)'  
{"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max\_score":1.0,"hits":[{"\_index":"attributes","\_type":"one","\_id":"json.txt","\_score":1.0,  
"\_source" : { "attributes" : [  
{ "base64" : true,  
"encrypted" : true,  
"name" : "ssn",  
"value" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="  
},  
{ "base64" : false,  
"encrypted" : false,  
"name" : "deviceId",  
"value" : "aass11234aaaxxxCC"  
}  
],  
"version" : 1337298622093  
}  
}]}}[root@dslg2 ~]# curl -XGET '  
[http://dslg1:9200/attributes/one/\_search?q=base64](http://dslg1:9200/attributes/one/_search?q=base64)'  
{"took":4,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max\_score":1.0,"hits":[{"\_index":"attributes","\_type":"one","\_id":"json.txt","\_score":1.0,  
"\_source" : { "attributes" : [  
{ "base64" : true,  
"encrypted" : true,  
"name" : "ssn",  
"value" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="  
},  
{ "base64" : false,  
"encrypted" : false,  
"name" : "deviceId",  
"value" : "aass11234aaaxxxCC"  
}  
],  
"version" : 1337298622093  
}

---

<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:** [May 20, 2012, 8:34pm UTC](https://discuss.elastic.co/t/query-returning-wrong-search-result/7768/2 "2012-05-20T20:34:17Z")

</div>

base64 is a boolean field, any value other than false, 0, off, no is  
considered true.

On Fri, May 18, 2012 at 10:24 PM, Mohit Anchlia [mohitanchlia@gmail.com](mailto:mohitanchlia@gmail.com)wrote:

> When I run search, whatever I give in the query string I am getting back  
> that one doc which doesn't even match my results. Am I doing something  
> wrong?
> 
> My Json parser seem to be putting double quotes around fields. Does  
> elasticsearch expects double quotes in the query string? Something like  
> q="base64":true?
> 
> [root@dslg2 ~]# curl -XGET '  
> [http://dslg1:9200/attributes/one/\_search?q=base64:false1](http://dslg1:9200/attributes/one/_search?q=base64:false1)'  
> {"took":2,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max\_score":1.0,"hits":[{"\_index":"attributes","\_type":"one","\_id":"json.txt","\_score":1.0,  
> "\_source" : { "attributes" : [  
> { "base64" : true,  
> "encrypted" : true,  
> "name" : "ssn",  
> "value" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="  
> },  
> { "base64" : false,  
> "encrypted" : false,  
> "name" : "deviceId",  
> "value" : "aass11234aaaxxxCC"  
> }  
> ],  
> "version" : 1337298622093  
> }  
> }]}}[root@dslg2 ~]# curl -XGET '  
> [http://dslg1:9200/attributes/one/\_search?q=base64](http://dslg1:9200/attributes/one/_search?q=base64)'  
> {"took":4,"timed\_out":false,"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max\_score":1.0,"hits":[{"\_index":"attributes","\_type":"one","\_id":"json.txt","\_score":1.0,  
> "\_source" : { "attributes" : [  
> { "base64" : true,  
> "encrypted" : true,  
> "name" : "ssn",  
> "value" : "EAAgfyaxpzdfcfv9Qexq1WtGvA=="  
> },  
> { "base64" : false,  
> "encrypted" : false,  
> "name" : "deviceId",  
> "value" : "aass11234aaaxxxCC"  
> }  
> ],  
> "version" : 1337298622093  
> }

---

<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:27am UTC](https://discuss.elastic.co/t/query-returning-wrong-search-result/7768/3 "2017-07-06T03:27:57Z")

</div>


