如何解决模板撰写期间无法替换映射字段
我试图在Elasticsearch 7.8.0中设置由某些组件模板组成的模板索引。 其中一个组件模板在现有对象上创建了新的字段映射,这引发了以下错误“映射字段[tcp]不能在模板组成期间替换”
以下是复制步骤:
PUT _component_template/tcp_service
{"template": {
"mappings": {
"properties": {
"tcp": {
"properties": {
"tcpService": {
"type": "keyword"
},"udpService": {
"type": "keyword"
}
}
}
}
}
}
}
哪个回复
{
"acknowledged" : true
}
然后创建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"
}
}
}
}
}
}
}
答案
{
"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
}
我在增加弹性搜索限制吗?
要做到这一点的唯一方法是在index_template中包含component_template字段?
模板索引对象不能用component_templates更新吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。