简体   繁体   中英

Why Elasticsearch have conflicting field mappings on migration from 1.x to 2.x?

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"?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM