如果指定的document不存在,就执行upsert中的初始化操作;
如果指定的document存在,就执行doc或者script指定的partial update操作
也就是说两种操作只能2选一
POST /test_index/test_type/11/_update
{
"script" : "ctx._source.num+=1",
"upsert": {
"num": 0,
"tags": []
}
}
如果指定的document不存在,就执行upsert中的初始化操作;
如果指定的document存在,就执行doc或者script指定的partial update操作
也就是说两种操作只能2选一
POST /test_index/test_type/11/_update
{
"script" : "ctx._source.num+=1",
"upsert": {
"num": 0,
"tags": []
}
}