You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Elasticsearch映射更新及模板新增字段问题求助

Elasticsearch映射更新及模板新增字段问题求助

大家好,我现在遇到一个Elasticsearch的问题,想给现有的索引模板添加两个新字段,但尝试更新映射的时候报错了,想请大家帮忙看看。

现有索引模板信息

我先获取了当前的模板,请求命令和返回结果如下:

curl -XGET 'http://endpoint_name/_template/es_template_dev?pretty'

返回的模板内容:

{
  "voice_incoming_es_template_dev" : {
    "order" : 0,
    "index_patterns" : ["data_dev*"],
    "settings" : {
      "index" : {
        "number_of_shards" : "1"
      }
    },
    "mappings" : {
      "es_template_dev" : {
        "properties" : {
          "id" : {"type" : "long"},
          "unqid_es" : {"type" : "keyword"},
          "id_call" : {"type" : "keyword"},
          "parent_id" : {"type" : "keyword"}
        }
      }
    },
    "aliases" : { }
  }
}

我尝试的操作及报错信息

我想用下面的命令给索引添加duration和duration_agents两个字段:

curl -XPUT -H "Content-Type: application/json" "http:endpoint/mapping/es_data_dev/"  -d '{
  "properties": {
    "duration": {"type": "integer"},
    "duration_agents": {"type": "integer"}
  }
}'

但收到了400错误,返回内容如下:

{
  "error":{
    "root_cause":[
      {
        "type":"illegal_argument_exception",
        "reason":"Rejecting mapping update to [2022_09] as the final mapping would have more than 1 type: [bd_stg, 20230301]"
      }
    ],
    "type":"illegal_argument_exception",
    "reason":"Rejecting mapping update to [voice_summary_obd_stg_2022_09] as the final mapping would have more than 1 type: [voice_stg, es_data_dev_20230301]"
  },
  "status":400
}

有没有大佬能帮我分析下这个错误的原因,以及正确的给现有模板添加新字段的方法呀?

备注:内容来源于stack exchange,提问作者MAHALAKSHMI MUTHAIAH

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 10:49:10