0
votes

I want to upgrade my elastic from 1.5.2 to 2.1.1 and when I use the migration plugin to find problems to solve, before the migration itself, I get errors on "Conflicting field mappings".

In the documentation about this issue, it says that:

Fields with the same name, in the same index, in different types, must have the same mapping, with the exception of the copy_to, dynamic, enabled, ignore_above, include_in_all, and properties parameters, which may have different settings per field. [...] Elasticsearch will not start in the presence of conflicting field mappings. These indices must be deleted or reindexed using a new mapping.

I failed to understand the reason it is the way it is... I mean why "Fields with the same name, in the same index, in different types, must have the same mapping"?

1
This was explained in full details in this blog postVal

1 Answers

2
votes

The problem is that types are stored in the same Lucene index. Lucene does not work with the context of type. Therefore the name of the field when used in two different types is the same as stored in Lucene. As Lucene uses the same name they have to have the same type.

So the following two fields will be added to the same field in Lucene:

index    -   type   -   field
myindex  -   type_a - fieldOne
myindex  -   type_b - fieldOne

In the lucene index are all called: fieldOne