已存在mapping中新增字段 (my_index自己的索引名)
PUT my_index/_mapping
{
"properties": {
"new_field_name": {
"type": "integer"
}
}
}
新增字段赋值
POST my_index/_update_by_query
{
"script": {
"lang": "painless",
"source": "ctx._source.new_field_name= 1"
}
}
查看(新增的字段已全赋值为1)
POST my_index/_search