You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Delete test index
DELETE lte_test
# Create test documents
POST lte_test/_doc/1
{
"test": "500"
}
POST lte_test/_doc/2
{
"test": "1000"
}
POST lte_test/_doc/3
{
"test": "foo"
}
POST lte_test/_doc/4
{
"test": "1000 foo"
}
# Force refresh
POST lte_test/_refresh
# Test range query
GET lte_test/_search
{
"query": {
"range": {
"test": {
"lte": 700
}
}
}
}
This will match any test field that has any number
Return doc 1 since 500 is less 700.
Should not return doc 2 since 1000 is not less than 700.
Should not return doc 4, since 1000 is not less than 700 and maybe because of mixed content.
Additional Details
There is a similar bug in aggs, where range with lte or gte matches everything
The text was updated successfully, but these errors were encountered:
If you didn't set the mapping of the field test to numeric type like long or integer, then the field will be mapped into text type plus a keyword type subfield, so at this point, performing range query will check the lexicographic order.
Performing range query on text or keyword field is not recommended, you should explicitly set the mapping before indexing documents into OpenSearch:
PUT test1/_mapping
{
"properties":{
"test":{
"type":"integer"
}
}
}
Describe the bug
lte
in queries like this matches any field that has any numbersRelated component
Other
To Reproduce
This will match any test field that has any number
Expected behavior
Return doc 1 since 500 is less 700.
Should not return doc 2 since 1000 is not less than 700.
Should not return doc 4, since 1000 is not less than 700 and maybe because of mixed content.
Additional Details
There is a similar bug in
aggs
, whererange
withlte
orgte
matches everythingThe text was updated successfully, but these errors were encountered: