How do I use retry_on_conflict to resolve error "ConflictError 409" with update()?
See original GitHub issueI noticed that if I send too many requests in a short period, my elasticsearch update code throws a 409 ConflictError. Reading a bit into it, I noticed there is a param for update() to set the number of retry attempts, however when I tried using it, I get another error:
RequestError(400, 'action_request_validation_exception', 'Validation Failed: 1: compare and write operations can not be retried;')
How can I handle 409 ConflictError during frequent updates and/or use the retry_on_conflict param?
thing = Thing.get(id=thing_id, ignore=404)
if thing:
return post.update(
script=update_func,
refresh=True,
retry_on_conflict=ES_UPDATE_RETRY_COUNT,
now=arrow.utcnow().float_timestamp,
)
ConflictError: ConflictError(409, 'version_conflict_engine_exception', '[TtWP-la58FPHbw]: version conflict, required seqNo [8], primary term [1]. current document has seqNo [9] and primary term [1]')
(2 additional frame(s) were not displaye
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
Version conflict when using the delete method of elasticsearch ...
This error is happening due to the version conflict in your documents. From ES official docs. Elasticsearch is distributed.
Read more >retry - Go Packages
RetryOnConflict is used to make an update to a resource when you have to worry about conflicts caused by other code making unrelated...
Read more >Developer Guide to Kubernetes Clients, Caches, Conflicts, etc.
Let's take a look at the different types of Kubernetes clients in go ... if there were concurrent updates to the object (conflict...
Read more >Couldn't resolve version – How to solve this Elasticsearch error
Common problems. If optimistic locking is not implemented while making updates to a document, Elasticsearch may return a conflict error with the 409...
Read more >How to fix Escenic content studio 409 conflict error - YouTube
Sometimes the java cache causes issues with escenic when you try to save things, here is how to fix that in simple and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
using elasticsearch-py directly seems to work…
This error seems to occur when adding
if_seq_no
andif_primary_term
to theupdate
arguments.https://github.com/elastic/elasticsearch-dsl-py/blob/7.3.0/elasticsearch_dsl/document.py#L407
Here’s a temporary solution: