es操作修改表结构

我爱海鲸 2022-07-07 12:27:01 暂无标签

简介head、修改表结构、修改新加的字段的数据

1、安装搭建,请参考其他文章或者自行百度

2、dsl语句:

添加字段:

PUT index/_mapping
{
    "properties":{
       "remark":{"type":"keyword"}
    }
}

修改旧数据:

POST  index/_doc/_update_by_query
{
  "script": {
    "lang": "painless",
    "inline": "if (ctx._source.remark== null) {ctx._source.remark= '备注'}"
  },
  "query":{
    "bool":{
      "must_not":{
        "exists":{
          "field":"remark"
        }
      }
    }
  }
}

head操作:

你好:我的2025