Is this an error in documentation of "numeric_detection"

Hi,
I was going through the documentation of Dynamic Field Mapping.

In the table I see the last entry:

JSON data type.......................................Elasticsearch data type
string........................................................ Either a date field (if the value passes date detection), a double or long field (if the value passes numeric detection) or a text field, with a keyword sub-field.

My understanding is that the default will be double or long.

However in the same page later on, the section on Numeric Detection has an example where it is said:

The my_float field is added as a float field.

It mapped it as a float instead of double.

It depends on what is detected.

Again, it depends on what is detected.

Hi Mark,

Here is what the documentation is saying on the numeric types:
long -> A signed 64-bit integer
double -> A double-precision 64-bit IEEE 754 floating point number
float -> A single-precision 32-bit IEEE 754 floating point number

And it is here I am getting confused. It should have detected it as a long or double. But it detected it as float.

Should the documentation for Dynamic field mapping say that it can be detected as long, double or float?

It's picked the smallest "size" mapping for the provided my_float value, which is a float.

The documentation is saying:
string -> Either a date field (if the value passes date detection), a double or long field (if the value passes numeric detection) or a text field, with a keyword sub-field.

There is no mention of the fact that it will strive to choose the smallest "size".

I know it might look like splitting the hair but I am getting tripped with error
Bad Request: [status_exception] cannot merge mappings because of differences for field
while creating a Analytics Job.

The data is monthly data and I see that for some months the data is mapped a double and for others as float. Hence the question.

If you are using dynamic mapping then there may be some differences as Elasticsearch tries to do its best, but it's not guaranteed to be consistent.

Sounds like you should use a mapping template instead.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.