-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search/SearchSearch-related issues that do not fall into other categoriesSearch-related issues that do not fall into other categoriesdiscuss
Description
We are running ES v5.6.3. When issuing a search query against a field of long type, we noticed that values are clipped to LONG_MAX/MIN when the value is out of range for the long type.
To reproduce
"docs": {
"properties": {
"Id": {
"type": "keyword"
},
"long": {
"type": "long"
},
}
}
-
Index a document with Long.MAX_VALUE (9223372036854775807).
-
Issue a search against the field "long" with a out-of-range values
_search/?q=long:9223372036854775808
_search/?q=long:9223372036854775809
returns the document with Long.MAX_VALUE (9223372036854775807) indexed above.
In ES1, such query throws a NumberFormatException. We believe ES6 would throw as well, looking at the code.
We think dd37cd14a4 is the responsible commit, line 731 of NumberFieldMapper.java.
+ try {
+ return Long.parseLong(stringValue);
+ } catch (NumberFormatException e) {
+ return (long) Double.parseDouble(stringValue); <-------------- 731
+ }
Metadata
Metadata
Assignees
Labels
:Search/SearchSearch-related issues that do not fall into other categoriesSearch-related issues that do not fall into other categoriesdiscuss