Index 'string' type to field mapping type of 'float' or 'double' results in 'string'

(horse.badorties.ny) #1


I have a mapping for a field in v1.7.1 where "dynamic": "strict", such as:

  "score": {
    "type": "float"

Per the note in mapping , I would think that the string value would be converted to the field type if possible and throw an error if not.

If the doc inserted has a string value for 'score', such as "1.1", es appears to index the field as a string. I get the same result if the field type is 'double'.

{ "score": "1.1"}

If the doc inserted has a number type for 'score', such as 1.1, es indexes it as the field type.

{ "score": 1.1}

If the field type is set to 'long' and insert the string "1.1", I receive an expected NumberFormatException.

I have tried setting the "ignore_malformed" value to false, with no change in the results.

Should I expected a string value to be typed to the field's type and throw an error if the type conversion fails? If not, what are the expected results?

(system) #2