# Parent-child relation not working with Elasticsearch 2.0.0-beta 2

**URL:** <https://discuss.elastic.co/t/parent-child-relation-not-working-with-elasticsearch-2-0-0-beta-2/33121>\
**Category:** Elasticsearch\
**Created:** [October 28, 2015, 4:50am UTC](https://discuss.elastic.co/t/parent-child-relation-not-working-with-elasticsearch-2-0-0-beta-2/33121 "2015-10-28T04:50:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vid](https://avatars.discourse-cdn.com/v4/letter/v/c5a1d2/32.png) [@Vid](https://discuss.elastic.co/u/Vid)\
**Post date:** [October 28, 2015, 4:50am UTC](https://discuss.elastic.co/t/parent-child-relation-not-working-with-elasticsearch-2-0-0-beta-2/33121/1 "2015-10-28T04:50:53Z")

</div>

We are trying to index data from two db tables (e.g: dept - master and employee - child) with parent-child relationship. We are able to index dept data which is parent. However, we are not able to index employee data (have attached error snippet below). If we remove the parent child filter mapping, then indexing works. Any pointers on this would greatly help. Thanks.

\*\*\*\* error \*\*\*\*\* response=\>{"index"=\>{"\_index"=\>"empdept", "\_type"=\>"emp", "\_id"=\>"1", "status"=\>400, "error"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"Mapper for [\_parent] conflicts with existing mapping in other types:\n[mapper [\_parent] cannot be changed from type [\_parent] to [long]]"}}}, :level=\>:warn}

* * *

\*\*\* Template \*\*\*\*\*  
curl -XPUT [http://XXXXXX](http://XXXXXX):XXXX/\_template/emp\_depl\_templ -d '  
{  
"template": "emp\_depl\_templ",  
"settings" : {  
"number\_of\_shards" : 5  
},  
"mappings" : {  
"dept" : {  
"properties" : {  
"deptid" : {"type" : "long"},  
"deptname" : { "type" : "string"}  
}  
},  
"emp" : {  
"\_parent" : {"type":"dept"},  
"\_routing" :{"required":true},  
"properties" : {  
"empno" : {"type" : "long"},  
"ename" : { "type" : "string"},  
"salary" : {"type" : "long"},  
"deptid" : {"type" : "long"}  
}  
}  
}  
}'

* * *

## dept.conf

## input { ... .. } output { elasticsearch { #protocol =\> http #user =\> "xxxx" #password =\> "xxxxx" index =\> "empdept" #manage\_template =\> true template\_name =\> "emp\_depl\_temp\*" document\_type =\> "dept" document\_id =\> "%{deptid}" hosts =\> "xxxxxx" #bind\_port =\> "xxxxx" flush\_size =\> 1000 } stdout { codec =\> rubydebug }

## emp.conf

input {  
}  
output {  
{  
elasticsearch {  
#protocol =\> http  
#user =\> "xxxx"  
#password =\> "xxx"  
index =\> "empdept"  
#manage\_template =\> true  
template\_name =\> "emp\_depl\_temp\*"  
document\_type =\> "emp"  
document\_id =\> "%{empno}"  
hosts =\> "xxxx"  
#bind\_port =\> "xxx"  
flush\_size =\> 1000  
}  
stdout { codec =\> rubydebug }  
}

---

<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:** [July 5, 2017, 11:42pm UTC](https://discuss.elastic.co/t/parent-child-relation-not-working-with-elasticsearch-2-0-0-beta-2/33121/2 "2017-07-05T23:42:04Z")

</div>


