is the order of "update" requests (against the same index and document/id) guaranteed?
Yes if requests are sent one after the other (after the response from elasticsearch). No if they are sent in parallel (without waiting for elasticsearch response) even though one after the other.
So if you run this in Kibana (I think there was some typos in your example):
DELETE test
PUT test
PUT test/_doc/docA
{
"keyA": "",
"keyB": ""
}
PUT test/_doc/docA
{
"keyA": "1",
"keyB": ""
}
PUT test/_doc/docA
{
"keyA": "1",
"keyB": "2"
}
PUT test/_doc/docA
{
"keyA": "3",
"keyB": "2"
}
GET test/_doc/docA
PUT test/_doc/docA
{
"keyA": "4",
"keyB": "2"
}
GET test/_doc/docA
You will always get back:
# DELETE test
{
"acknowledged" : true
}
# PUT test
{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "test"
}
# PUT test/_doc/docA
{
"_index" : "test",
"_type" : "_doc",
"_id" : "docA",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 0,
"_primary_term" : 1
}
# PUT test/_doc/docA
{
"_index" : "test",
"_type" : "_doc",
"_id" : "docA",
"_version" : 2,
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 1,
"_primary_term" : 1
}
# PUT test/_doc/docA
{
"_index" : "test",
"_type" : "_doc",
"_id" : "docA",
"_version" : 3,
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 2,
"_primary_term" : 1
}
# PUT test/_doc/docA
{
"_index" : "test",
"_type" : "_doc",
"_id" : "docA",
"_version" : 4,
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 3,
"_primary_term" : 1
}
# GET test/_doc/docA
{
"_index" : "test",
"_type" : "_doc",
"_id" : "docA",
"_version" : 4,
"_seq_no" : 3,
"_primary_term" : 1,
"found" : true,
"_source" : {
"keyA" : "3",
"keyB" : "2"
}
}
# PUT test/_doc/docA
{
"_index" : "test",
"_type" : "_doc",
"_id" : "docA",
"_version" : 5,
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 4,
"_primary_term" : 1
}
# GET test/_doc/docA
{
"_index" : "test",
"_type" : "_doc",
"_id" : "docA",
"_version" : 5,
"_seq_no" : 4,
"_primary_term" : 1,
"found" : true,
"_source" : {
"keyA" : "4",
"keyB" : "2"
}
}