Skip to content

Allow op_type to be set on save methods in (Reactive)ElasticsearchOperations.  #2283

Open
@frnandu

Description

@frnandu

Currently when using repository save operation it will always use op_type index, which doesn't allow to detect concurrent creation of same entity with same generated id (so that if first operation succeed and it creates, the second will fail since it already exists a document with same id).
If I understand correctly usage of seq_no + primary_term is still not possible in the creation phase of the document, only after it is created for subsequent update operations.
Since in ReactiveCrudRepository there isn't a create method which elasticsearch implementation can implement, there should be some way of telling to force creation of entity when using the save method or failing if it already exists.
Without this it seems to me one cannot implement a fully optimistic locking lifecycle for entities/documents which need to have a generated id and concurrency control which avoids creating documents with same id being overwritten. Checking before saving for existence of entity doesn't resolve every scenario when concurrent requests are made.
Do you have any ideas how to resolve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions