Numeric format exception on term query with empty value

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!

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