Es 2.4 , can't add a _parent field that points to an already existing type


(Miguel Michelsongs) #1

Hi guys, how are you today ?

I have a index with records on type1, And I'm trying to add a new type type2 which has a type1 parent type.
i'm receiving the error can't add a _parent field that points to an already existing type but I don't understand this.

as 2.4.0 is supposed to work when adding new mapping to index right ?
https://github.com/elastic/elasticsearch/issues/17956 , i'm using es 2.4.5 but it don't work

can you give me some hints on how to do it ?

thanks


(Medcl) #2

I think this PR is not merged into 2.x branch, @mvg may provide more details.


(Medcl) #3

Hi, @Miguel_Michelsongs
It was merged, and just confirmed with @mvg that from 2.x, you can't add child types to a non-parent type on the fly, you need to make sure the type you are using is already a "parent" type, because after 2.0, the _parent field stores as special doc values field used for joining, if your parent type doesn't have this value, there maybe some potential issue, like missmatch or incorrect docs.


(Miguel Michelsongs) #4

Hi @medcl.net, thanks for your reply.
just two more questions,
how can I know that the type is a parent type ?
if the type is not a parent type , then how can I update this in order to transform the type to a parent type without loosing indexed records ? is possible to use alias strategy for this ?

ps: I'd get this working indexing the type2 first, and then create type1, after that i've to reindex records on type1

best regards


(Medcl) #5

Hi, @Miguel_Michelsongs
Sorry for the late reply, you can't change the type, you must create the type2 and type during the index creation, and set the type as parent, after that, you may use create type1 anytime to use type as parent type.


(system) #6

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