# Json query not returning results

**URL:** <https://discuss.elastic.co/t/json-query-not-returning-results/14559>\
**Category:** Elasticsearch\
**Created:** [November 23, 2013, 4:43pm UTC](https://discuss.elastic.co/t/json-query-not-returning-results/14559 "2013-11-23T16:43:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Levon\_Tamrazov](https://avatars.discourse-cdn.com/v4/letter/l/f0a364/32.png) [@Levon\_Tamrazov](https://discuss.elastic.co/u/Levon_Tamrazov)\
**Post date:** [November 23, 2013, 4:43pm UTC](https://discuss.elastic.co/t/json-query-not-returning-results/14559/1 "2013-11-23T16:43:58Z")

</div>

Hi,  
I am learning elasticsearch and following along with the tutorial. I  
uploaded three documents into an index. When I supply the following query:

curl 'localhost:9200/vehicles/\_search?query=driver.name:Jon'

I as expected get back object two and object three. However when I try  
querying using json:

curl localhost:9200/vehicles/\_search -d'

{

"query":{

"prefix":{

"driver.name":"Jon"

}}}'

I get no results back. I am following the tutorial very closely, so I don't  
understand what the issue is. Any help would be really appreciated. The  
uploaded objects are below.

Thank you!  
id:one  
'{  
"color": "green",  
"driver": {  
"born":"1989-09-12",  
"name": "Ben"  
},  
"make": "BMW",  
"model": "Aztek",  
"value": 3000.0,  
"year": 2003  
}'

id:two  
'{  
"color": "black",  
"driver": {  
"born":"1934-09-08",  
"name": "Jon"  
},  
"make": "Mercedes",  
"model": "Benz",  
"value": 10000.0,  
"year": 2012  
}'

id:three  
'{  
"color": "green",  
"driver": {  
"born":"1934-09-08",  
"name": "Jon"  
},  
"make": "BMW",  
"model": "Benz",  
"value": 10000.0,  
"year": 2012  
}'

--  
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:** [November 23, 2013, 6:21pm UTC](https://discuss.elastic.co/t/json-query-not-returning-results/14559/2 "2013-11-23T18:21:13Z")

</div>

Try with jon lowercase.

Prefix query is not analyzed.  
But your field has been indexed as "jon".

HTH

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

Le 23 nov. 2013 à 17:43, Levon Tamrazov [ltamrazov@gmail.com](mailto:ltamrazov@gmail.com) a écrit :

> Hi,  
> I am learning elasticsearch and following along with the tutorial. I uploaded three documents into an index. When I supply the following query:
> 
> curl 'localhost:9200/vehicles/\_search?query=driver.name:Jon'
> 
> I as expected get back object two and object three. However when I try querying using json:
> 
> curl localhost:9200/vehicles/\_search -d'
> 
> {
> 
> "query":{
> 
> "prefix":{
> 
> "driver.name":"Jon"
> 
> }}}'
> 
> I get no results back. I am following the tutorial very closely, so I don't understand what the issue is. Any help would be really appreciated. The uploaded objects are below.
> 
> Thank you!
> 
> id:one  
> '{  
> "color": "green",  
> "driver": {  
> "born":"1989-09-12",  
> "name": "Ben"  
> },  
> "make": "BMW",  
> "model": "Aztek",  
> "value": 3000.0,  
> "year": 2003  
> }'
> 
> id:two  
> '{  
> "color": "black",  
> "driver": {  
> "born":"1934-09-08",  
> "name": "Jon"  
> },  
> "make": "Mercedes",  
> "model": "Benz",  
> "value": 10000.0,  
> "year": 2012  
> }'
> 
> ## id:three '{ "color": "green", "driver": { "born":"1934-09-08", "name": "Jon" }, "make": "BMW", "model": "Benz", "value": 10000.0, "year": 2012 }'
> 
> 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:** ![Levon\_Tamrazov](https://avatars.discourse-cdn.com/v4/letter/l/f0a364/32.png) [@Levon\_Tamrazov](https://discuss.elastic.co/u/Levon_Tamrazov)\
**Post date:** [November 25, 2013, 5:38pm UTC](https://discuss.elastic.co/t/json-query-not-returning-results/14559/3 "2013-11-25T17:38:07Z")

</div>

Thank you! That was exactly it, worked like a charm.

On Saturday, 23 November 2013 13:21:13 UTC-5, David Pilato wrote:

> Try with jon lowercase.
> 
> Prefix query is not analyzed.  
> But your field has been indexed as "jon".
> 
> HTH
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 23 nov. 2013 à 17:43, Levon Tamrazov \<[ltam...@gmail.com](mailto:ltam...@gmail.com) \<javascript:\>\>  
> a écrit :
> 
> Hi,  
> I am learning elasticsearch and following along with the tutorial. I  
> uploaded three documents into an index. When I supply the following query:
> 
> curl 'localhost:9200/vehicles/\_search?query=driver.name:Jon'
> 
> I as expected get back object two and object three. However when I try  
> querying using json:
> 
> curl localhost:9200/vehicles/\_search -d'
> 
> {
> 
> "query":{
> 
> "prefix":{
> 
> "driver.name[http://www.google.com/url?q=http%3A%2F%2Fdriver.name&sa=D&sntz=1&usg=AFQjCNErou1shw6oSTaKg-2VfDONgFOsSA](http://www.google.com/url?q=http%3A%2F%2Fdriver.name&sa=D&sntz=1&usg=AFQjCNErou1shw6oSTaKg-2VfDONgFOsSA)  
> ":"Jon"
> 
> }}}'
> 
> I get no results back. I am following the tutorial very closely, so I  
> don't understand what the issue is. Any help would be really appreciated.  
> The uploaded objects are below.
> 
> Thank you!  
> id:one  
> '{  
> "color": "green",  
> "driver": {  
> "born":"1989-09-12",  
> "name": "Ben"  
> },  
> "make": "BMW",  
> "model": "Aztek",  
> "value": 3000.0,  
> "year": 2003  
> }'
> 
> id:two  
> '{  
> "color": "black",  
> "driver": {  
> "born":"1934-09-08",  
> "name": "Jon"  
> },  
> "make": "Mercedes",  
> "model": "Benz",  
> "value": 10000.0,  
> "year": 2012  
> }'
> 
> id:three  
> '{  
> "color": "green",  
> "driver": {  
> "born":"1934-09-08",  
> "name": "Jon"  
> },  
> "make": "BMW",  
> "model": "Benz",  
> "value": 10000.0,  
> "year": 2012  
> }'
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> 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:** ![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:04am UTC](https://discuss.elastic.co/t/json-query-not-returning-results/14559/4 "2017-07-06T02:04:55Z")

</div>


