Hi, I'm trying to setup a template index composed of some component templates. One of the component templates creates new fields mapping on an existing object, and this raises the following error "mapping fields [tcp] cannot be replaced during template composition"
Here are the steps to reproduce:
PUT _component_template/tcp_service
{"template": {
"mappings": {
"properties": {
"tcp": {
"properties": {
"tcpService": {
"type": "keyword"
},
"udpService": {
"type": "keyword"
}
}
}
}
}
}
}
Which responds
{
"acknowledged" : true
}
And then create the index_template
PUT _index_template/data
{
"index_patterns": ["data_*"],
"composed_of": ["tcp_service"],
"template": {
"aliases": {
"data": {}
},
"settings": {
"index": {
"number_of_shards": "2",
"number_of_replicas": "1"
}
},
"mappings": {
"properties": {
"tcp": {
"properties": {
"dstPort": {
"type": "keyword"
}
}
}
}
}
}
}
And the answer
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "composable template [data] template after composition with component templates [tcp_service] is invalid"
}
],
"type" : "illegal_argument_exception",
"reason" : "composable template [data] template after composition with component templates [tcp_service] is invalid",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "invalid composite mappings for [data]",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "mapping fields [tcp] cannot be replaced during template composition"
}
}
},
"status" : 400
}
Am I trying to do anything impossible?
Is the only way to accomplish this to include component_template fields in index_template?
Can't Objects be updated with component_templates?
Kind regards, Manuel