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: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 }
}