-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow op_type to be set on save methods in (Reactive)ElasticsearchOperations. #2283
Comments
what do you mean with "same generated id"? Who creates this id?****
Right. Elasticsearch only returns Currently there is no possibility in the |
I mean composite id using few fields from an entity (ex: Vote which is identified by concatenating entity_name + user_id + entity_id).
Could it be added such possibility easily? Thanks |
That won't be too hard, it means to add new overloaded versions of |
see #2089 as well |
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?
The text was updated successfully, but these errors were encountered: