Your mapping is correct, i.e. the male
field is of type float
.
In your source document, "0.11"
and 0.11
will be interpreted the same way by Elasticsearch because it will try to coerce the string value into a float, so nothing's really wrong per se.
Moreover, it sometimes makes more sense to store float numbers as strings in the source document because of the known precision issues with float numbers in Javascript/JSON. In that sense, the first document would be the "correct" one and the second one would be the "wrong" one.
None are actually wrong, both will work, yet the second one (with numerical float values) might probably incur precision issues in aggregations (sum, avg, etc)