Open ioanatia opened 1 week ago
Pinging @elastic/es-search-relevance (Team:Search Relevance)
Pinging @elastic/es-search (Team:Search)
It looks like we have added validations for finite values with https://github.com/elastic/elasticsearch/issues/25534 - the issue had to with disallowing out of range values at indexing time, which makes perfect sense - but the fix also added the restriction to range
, term
and terms
queries. I am not sure whether this was the intention or a side effect - the tests don't seem to cover the effect on queries.
Elasticsearch Version
main
Installed Plugins
No response
Java Version
bundled
OS Version
-
Problem Description
NumberFieldMapper
has inconsistent validations for out of range values for term queries.I propose we refactor
NumberFieldMapper
such that we remove these validations for out of range values forterm
andterms
queries. When an out of range value is sent for aterm
query we can return aMatchNoDocsQuery
. We can figure out a similar optimization forTerms
queries.Steps to Reproduce
These steps are just for
double
andinteger
fields - but the issue has to do with all numeric field types. Either we consistently return an error for all out of range values for all numeric types or we remove the validation.integer
:response:
Test with another out of range value
response:
double
field:response:
Impact on ES|QL
https://github.com/elastic/elasticsearch/issues/105079 reported a similar issue but for range queries.
These ES|QL queries produce no errors since we fixed https://github.com/elastic/elasticsearch/issues/105079:
But when we have:
FROM testidx | WHERE half_float_field == 1E300
this will return an error since this ES|QL query is translated to a term query. This is an additional argument for removing the validations for out of range values forterm
andterms
queries, since this would make the behaviour consistent withrange
queries.Logs (if relevant)
No response