Describe the bug
When index has mapped field of type scaled_float with ignore_malformed set,
and a document is inserted with value of this field equal to false, then mapper_parsing_exception is thrown.
Interestingly, this bug isn't reproduced for a regular float fields.
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [amount] of type [scaledfloat] in document with id 'iL1EJ4ABZDKYwbEvExL'. Preview of field's value: 'false'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [amount] of type [scaledfloat] in document with id 'iL1EJ4ABZDKYwbEvExL'. Preview of field's value: 'false'",
"caused_by": {
"type": "json_parse_exception",
"reason": "Current token (VALUE_FALSE) not numeric, can not use numeric value accessors\n at [Source: (byte[])\"{\n \"amount\": false\n}\"; line: 2, column: 20]"
}
},
"status": 400
}
Expected behavior
No exception thrown
Document inserted to OpenSearch
Plugins
Plugins installed by default by AWS OpenSearch:
@tszajna0 thanks for reporting this.
I was able to reproduce the problem with instructions. The implementation of float and scaled_float is different causing this edge case to miss.
I've sent out #2918 to fix it.
Describe the bug When index has mapped field of type
scaled_float
withignore_malformed
set, and a document is inserted with value of this field equal tofalse
, thenmapper_parsing_exception
is thrown.Interestingly, this bug isn't reproduced for a regular
float
fields.To Reproduce Steps to reproduce the behavior:
Create an index
PUT {{ENDPOINT}}/test { "mappings": { "properties": { "amount": { "type": "scaled_float", "ignore_malformed": true, "scaling_factor": 100.0 } } }, "settings": { "index.mapping.ignore_malformed": "true" } }
Try to insert document
POST {{ENDPOINT}}/test/_doc { "amount": false }
See error
{ "error": { "root_cause": [ { "type": "mapper_parsing_exception", "reason": "failed to parse field [amount] of type [scaledfloat] in document with id 'iL1EJ4ABZDKYwbEvExL'. Preview of field's value: 'false'" } ], "type": "mapper_parsing_exception", "reason": "failed to parse field [amount] of type [scaledfloat] in document with id 'iL1EJ4ABZDKYwbEvExL'. Preview of field's value: 'false'", "caused_by": { "type": "json_parse_exception", "reason": "Current token (VALUE_FALSE) not numeric, can not use numeric value accessors\n at [Source: (byte[])\"{\n \"amount\": false\n}\"; line: 2, column: 20]" } }, "status": 400 }
Expected behavior
Plugins Plugins installed by default by AWS OpenSearch:
Screenshots not applicable
Host/Environment (please complete the following information):
Version 1.2.4 (AWS latest)
{ "name": "1e7975406315f4b7e4cce0fec3113412", "cluster_name": "317751443469:neo-dev", "cluster_uuid": "lwO0rLR9R_6PmUvKrE4Bdg", "version": { "distribution": "opensearch", "number": "1.2.4", "build_type": "tar", "build_hash": "unknown", "build_date": "2022-02-12T00:31:03.809773Z", "build_snapshot": false, "lucene_version": "8.10.1", "minimum_wire_compatibility_version": "6.8.0", "minimum_index_compatibility_version": "6.0.0-beta1" }, "tagline": "The OpenSearch Project: https://opensearch.org/" }
Additional context not applicable