Implementing a lock in Elasticsearch

At Kestra, the workflow orchestration and scheduling platform I work for, we have two repository implementations: JDBC (with support for H2, MySQL, and Postgres) and Elasticsearch. In JDBC, locking a record for processing is fairly easy: 1. SELECT FOR UPDATE ... WHERE ... will place a lock on the record(s) 2. We process the record(s) in the same transaction 3. UPDATE... At the end of the…