# Numeric format exception on term query with empty value

**URL:** <https://discuss.elastic.co/t/numeric-format-exception-on-term-query-with-empty-value/111555>\
**Category:** Elasticsearch\
**Created:** [December 13, 2017, 12:31pm UTC](https://discuss.elastic.co/t/numeric-format-exception-on-term-query-with-empty-value/111555 "2017-12-13T12:31:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davteje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davteje/32/25495_2.png) [@davteje](https://discuss.elastic.co/u/davteje)\
**Post date:** [December 13, 2017, 12:31pm UTC](https://discuss.elastic.co/t/numeric-format-exception-on-term-query-with-empty-value/111555/1 "2017-12-13T12:31:43Z")

</div>

I have a term query on a numeric field where the search can sometimes be an empty value:  
`"term": { "numeric_field": "" }`  
I would like this query to not return any result but instead it throws a numeric format exception.

Is there any way to avoid this error?  
I would like to use something like "lenient" option in query\_string, but it is not available for the term query.

Thank you!

---

<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:** [January 10, 2018, 12:32pm UTC](https://discuss.elastic.co/t/numeric-format-exception-on-term-query-with-empty-value/111555/2 "2018-01-10T12:32:07Z")

</div>

Closed on January 10, 2018, 12:32pm UTC

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