ES concurrent update question

  1. let's assume concurrent update operation is A, B
  2. let's assume each shard has one replica, then P and R stands for primary and R stands for replica
  3. let's assume update operation without specifying version and therefore use internal versiont type

so it could happen different things:

  1. P execute A, B, R execute A, B
  2. P execute A, B, R execute B, A
  3. P execute A, B, R execute only A, B has failed on R due to version conflict
  4. P execute only A and B failed due to version conflit. R execute A

all of the above has the possibility to happen, right?

It all depends on the primary, not the replica(s).

If A arrives to the primary before B then change A will get (eg) version 2, and change B will get version 3. Theses changes are sent to the replica as the whole document, not just the update command.

If version 2 arrives before version, then they are both applied in order. If version 3 arrives before version 2 then version 3 is applied, and version 2 is silently rejected (because it is older than version 3).

Either way, the replica stays in sync with the primary.

get it. thanks