模板合成期间无法替换Map字段

rqenqsqc  于 2021-06-14  发布在  ElasticSearch
关注(0)|答案(0)|浏览(555)

我正在尝试在ElasticSearch7.8.0中设置一个由一些组件模板组成的模板索引。其中一个组件模板在现有对象上创建新的字段Map,这将引发以下错误“在模板组合期间无法替换Map字段[tcp]”
以下是重现的步骤:

PUT _component_template/tcp_service
    {"template": {
            "mappings": {
                "properties": {
                    "tcp": {
                        "properties": {
                            "tcpService": {
                                "type": "keyword"
                            },
                            "udpService": {
                                "type": "keyword"
                            }
                        }
                    }
                }
            }
        }
    }

哪种React

{
"acknowledged" : true
}

然后创建索引模板

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
}

我是否提高了ElasticSearch限制?
实现这一点的唯一方法是在索引模板中包含组件模板字段吗?
模板索引对象不能用组件模板更新吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题