1 - 单个更新指定字段
update table set first_time = 1 where id=1
POST test/doc/1/_update { "doc": { "first_time": 1 } }
2 - 批量更新字段
update table set first_time = last_time where first_time=0 and last_time !=0
POST test/_update_by_query { "script": { "source": "ctx._source.first_time=ctx._source.last_time" }, "query": { "bool": { "must": [ { "term": { "first_time": 0 } } ], "must_not": [ { "term": { "last_time": 0 } } ] } } }