1、语法:
post /index/type/id/_update
{
"doc": {
"要修改的少数几个field即可,不需要全量的数据"
}
}
每次传递少数几个发生修改的field即可,不需要将全量的document数据发送过去
2、partial update相对于全量替换的优点
a、所有的查询、修改都发生在一个shard 避免了所有网络数据的开销 大大提升性能
b、减少了查询和修改的 时间间隔,减少了并发冲突的情况
3、案例
PUT /test_index/test_type/10
{
"test_field1": "test1",
"test_field2": "test2"
}
POST /test_index/test_type/10/_update
{
"doc": {
"test_field2": "updated test2"
}
}