You don’t need to hope, that is the documented and expected behavior! Just try it , eg in Kibana DevTools:
# 152: PUT /your_index_name/_doc/1 [201 Created]
# {"a": "value_a","b": "value_b","c": "value_c"}
{
"_index": "your_index_name",
"_id": "1",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1
}
# 154: GET /your_index_name/_doc/1 [200 OK]
{
"_index": "your_index_name",
"_id": "1",
"_version": 1,
"_seq_no": 0,
"_primary_term": 1,
"found": true,
"_source": {
"a": "value_a",
"b": "value_b",
"c": "value_c"
}
}
# 155: POST /your_index_name/_update/1 [200 OK]
# {"doc": {"a": "new_value_a","b": "new_value_b"}}
{
"_index": "your_index_name",
"_id": "1",
"_version": 2,
"result": "updated",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 1,
"_primary_term": 1
}
# 157: GET /your_index_name/_doc/1 [200 OK]
{
"_index": "your_index_name",
"_id": "1",
"_version": 2,
"_seq_no": 1,
"_primary_term": 1,
"found": true,
"_source": {
"a": "new_value_a",
"b": "new_value_b",
"c": "value_c"
}
}
Essentially the doc is updated via
- getting (current) version N of the doc
- fields (from that doc and the POST call) are merged
- version N+1 is stored in the index
@S-Dragon0302 Are you seeing something different?