-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch
Description
Elasticsearch version:
5.4.1
Description of the problem including expected versus actual behavior:
mapper_parsing_exception is thrown for numeric field with ignore_malformed=true when inserting a "NaN" value.
I would expect that no exception is returned for a field with ignore_malformed=true
Steps to reproduce:
First create an index with a mapping with a numeric field with ignore_malformed = true:
PUT nan_test
{
"mappings": {
"test_type": {
"properties": {
"number_one": {
"type": "scaled_float",
"scaling_factor": 1,
"ignore_malformed": true
}
}
}
}
}
{"acknowledged":true,"shards_acknowledged":true}
Then insert a malformed number, works as expected:
PUT nan_test/test_type/1?pretty
{
"number_one": "not a number"
}
{
"_index" : "nan_test",
"_type" : "test_type",
"_id" : "1",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 2,
"failed" : 0
},
"created" : true
}
Now, let's insert a number with the "NaN" string value:
PUT nan_test/test_type/2?pretty
{
"number_one": "NaN"
}
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "failed to parse [number_one]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "failed to parse [number_one]",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "[scaled_float] only supports finite values, but got [NaN]"
}
},
"status" : 400
}
Shouldn't ignore_malformed = true ignore all mapper_parsing_exception?
If not, how can I ignore the exception raised by "NaN" values?
Note that NaN has no special meaning in json, so it seems strange that it is considered a special input value.
Metadata
Metadata
Assignees
Labels
:Search Foundations/MappingIndex mappings, including merging and defining field typesIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in ElasticsearchMeta label for the Search Foundations team in Elasticsearch