# Query doesn't find results

**URL:** <https://discuss.elastic.co/t/query-doesnt-find-results/21115>\
**Category:** Elasticsearch\
**Created:** [December 5, 2014, 6:43pm UTC](https://discuss.elastic.co/t/query-doesnt-find-results/21115 "2014-12-05T18:43:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugen\_Paraschiv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugen_paraschiv/32/919_2.png) [@Eugen\_Paraschiv](https://discuss.elastic.co/u/Eugen_Paraschiv)\
**Post date:** [December 5, 2014, 6:43pm UTC](https://discuss.elastic.co/t/query-doesnt-find-results/21115/1 "2014-12-05T18:43:14Z")

</div>

Hi,  
I have the following document mapping:  
{  
"asset": {  
"properties": {  
"name": {  
"analyzer": "keyword",  
"store": true,  
"type": "string"  
},  
"id": {  
"index": "not\_analyzed",  
"type": "string"  
}  
}  
}  
}  
Notice the _keyword_ analyzer - the name _will contain whitespace_ - and so  
I need it not to be tokenized but instead treated as a single token.

Here's a sample document (I removed some of the details for conciseness):  
{  
"\_index": "local\_defaultorg\_asset",  
"\_type": "asset",  
"\_id": "jvMXDQYuSkqml3\_QNfP\_Gg",  
"\_score": 1,  
"\_source": {  
"id": null,  
"name": "yLYNQU ywYXzS",  
}  
}

Now, I'm running the following query (generated by Spring Data, so I don't  
have a lot of control over it):  
{  
"from": 0,  
"query": {  
"bool": {  
"must": {  
"query\_string": {  
"query": "yLYNQU ywYXzS",  
"fields": [  
"name"  
]  
}  
}  
}  
}  
}

But, unfortunately, I'm getting no results.  
In a similar situation but without the whitespace, everything looks good  
and the query's able to find my document.  
Am I missing anything on the mapping side?  
Thanks,  
Eugen.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9a8f9c9d-9227-42d2-aeae-4cdcf0236f08%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9a8f9c9d-9227-42d2-aeae-4cdcf0236f08%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [December 5, 2014, 9:36pm UTC](https://discuss.elastic.co/t/query-doesnt-find-results/21115/2 "2014-12-05T21:36:46Z")

</div>

I believe that the query\_string has its own syntax that assumes  
tokenization and other preprocessing.

Maybe if you added name: to the query? But I am not sure how you would tell  
the query string that your phrase is really one token.

But, thanks for giving me one more reason to avoid Spring!

Brian

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4c6b4f8c-4600-435b-93f1-db62c807cf4f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4c6b4f8c-4600-435b-93f1-db62c807cf4f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:45am UTC](https://discuss.elastic.co/t/query-doesnt-find-results/21115/3 "2017-07-06T00:45:25Z")

</div>


