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

**URL:** https://discuss.elastic.co/t/es-2-4-cant-add-a--parent-field-that-points-to-an-already-existing-type/91819
**Category:** Elasticsearch
**Created:** [July 5, 2017, 1:26am UTC](https://discuss.elastic.co/t/es-2-4-cant-add-a--parent-field-that-points-to-an-already-existing-type/91819 "2017-07-05T01:26:22Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Miguel\_Michelsongs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/miguel_michelsongs/32/19766_2.png) [@Miguel\_Michelsongs](https://discuss.elastic.co/u/Miguel_Michelsongs)
#### Post date: [July 5, 2017, 1:26am UTC](https://discuss.elastic.co/t/es-2-4-cant-add-a--parent-field-that-points-to-an-already-existing-type/91819/1 "2017-07-05T01:26:22Z")

</div>

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](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

---

<div class="post-metadata">

### Author: ![medcl.net](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/medcl.net/32/4414_2.png) [@medcl.net](https://discuss.elastic.co/u/medcl.net)
#### Post date: [July 5, 2017, 5:46am UTC](https://discuss.elastic.co/t/es-2-4-cant-add-a--parent-field-that-points-to-an-already-existing-type/91819/2 "2017-07-05T05:46:36Z")

</div>

> [@Miguel\_Michelsongs](#):
>
> type1

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

---

<div class="post-metadata">

### Author: ![medcl.net](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/medcl.net/32/4414_2.png) [@medcl.net](https://discuss.elastic.co/u/medcl.net)
#### Post date: [July 5, 2017, 7:31am UTC](https://discuss.elastic.co/t/es-2-4-cant-add-a--parent-field-that-points-to-an-already-existing-type/91819/3 "2017-07-05T07:31:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Miguel\_Michelsongs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/miguel_michelsongs/32/19766_2.png) [@Miguel\_Michelsongs](https://discuss.elastic.co/u/Miguel_Michelsongs)
#### Post date: [July 5, 2017, 6:01pm UTC](https://discuss.elastic.co/t/es-2-4-cant-add-a--parent-field-that-points-to-an-already-existing-type/91819/4 "2017-07-05T18:01:42Z")

</div>

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

---

<div class="post-metadata">

### Author: ![medcl.net](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/medcl.net/32/4414_2.png) [@medcl.net](https://discuss.elastic.co/u/medcl.net)
#### Post date: [July 26, 2017, 12:47am UTC](https://discuss.elastic.co/t/es-2-4-cant-add-a--parent-field-that-points-to-an-already-existing-type/91819/5 "2017-07-26T00:47:14Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 23, 2017, 12:47am UTC](https://discuss.elastic.co/t/es-2-4-cant-add-a--parent-field-that-points-to-an-already-existing-type/91819/6 "2017-08-23T00:47:34Z")

</div>

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