Type mapping cannot be changed in either direction


I got a really strange behavior on one of our Elasticsearch instances running 6.x regarding the 'mapper cannot be changed' error.
We are using strict mapping on template level and we usually don't have data type changes for the fields. But somehow it has happened, that for some fields the mapping has changed. So now, we have this weird problem that we cannot change the mapping at all or even extend the existing mapping by more fields.

This is the first error message:
"type":"illegal_argument_exception","reason":"mapper [field_amount] cannot be changed from type [float] to [integer]"

Seems fine. Ok, let's change the type back to float:
"type":"illegal_argument_exception","reason":"mapper [field_amount] cannot be changed from type [integer] to [float]"


This is bad. How can I solve this problem, so that I'll be able to change the mapping of the template to add more fields?


Lucene cannot change the datatype of a field once it has been created. The only way to change from integer to float or the other way around is through a reindex.

Though adding new fields (with a field name that doesn't yet exist) is possible.

But how is it possible that there are both data types (integer and float) existing for the same field?

That's not possible. What is the output of GET <index-name>/_mapping (probably limited to the relevant section)?

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