elasticsearch中给已存在的mapping增加新字段并赋值

es中创建后的mapping不可修改,但是可以添加新字段
添加新字段:

PUT /my_index/_mapping/my_type
{
  "properties": {
       "new_field_name": {
           "type":     "string"
       }
   }
}

赋值:

POST my_index/_update_by_query
{
  "script": {
    "lang": "painless",
    "inline": "ctx._source.new_field_name= '02'"
  }
}

猜你喜欢

转载自blog.csdn.net/qq_34624315/article/details/83084291