POST my_index/_update_by_query
{
"script": {
"source": "ctx._source['ipsub']=0"
},
"query": {
"bool": {
"must_not": [
{
"exists": {
"field": "ipsub"
}
}
]
}
}
}
上面语句是根据是否存在"ipsub"字段,如果不存在,给信息增加字段"ipsub",并且赋值0