# How to handle search query with both words and numbers

**URL:** <https://discuss.elastic.co/t/how-to-handle-search-query-with-both-words-and-numbers/104054>\
**Category:** Elasticsearch\
**Created:** [October 16, 2017, 7:35am UTC](https://discuss.elastic.co/t/how-to-handle-search-query-with-both-words-and-numbers/104054 "2017-10-16T07:35:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karolinebryn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karolinebryn/32/17095_2.png) [@Karolinebryn](https://discuss.elastic.co/u/Karolinebryn)\
**Post date:** [October 16, 2017, 7:35am UTC](https://discuss.elastic.co/t/how-to-handle-search-query-with-both-words-and-numbers/104054/1 "2017-10-16T07:35:36Z")

</div>

Hi!  
How can I handle search queries that might contain both words and numbers (typically a year, but it can also be a paragraph, chapter etc) in a good way?

The issue is that if a user search for "taxes 2017" they will get hits in documents that contains only "taxes" but also only "2017". Now, hits in documents that only contains the word "taxes" makes sense and is ok, but hits in documents that contains only "2017" makes no sense at all. Is there a way to tell elasticsearch that numbers only have a meaning in combination with one or several words, but not by it self?

---

<div class="post-metadata">

**Author:** ![Karolinebryn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karolinebryn/32/17095_2.png) [@Karolinebryn](https://discuss.elastic.co/u/Karolinebryn)\
**Post date:** [October 18, 2017, 11:51am UTC](https://discuss.elastic.co/t/how-to-handle-search-query-with-both-words-and-numbers/104054/2 "2017-10-18T11:51:33Z")

</div>

Nobody knows? 😢

---

<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:** [November 15, 2017, 11:52am UTC](https://discuss.elastic.co/t/how-to-handle-search-query-with-both-words-and-numbers/104054/3 "2017-11-15T11:52:29Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
