# Does "retry\_on\_conflict" will handle updating the latest version number before retrying again?

**URL:** <https://discuss.elastic.co/t/does-retry-on-conflict-will-handle-updating-the-latest-version-number-before-retrying-again/281738>\
**Category:** Elasticsearch\
**Created:** [August 17, 2021, 6:20pm UTC](https://discuss.elastic.co/t/does-retry-on-conflict-will-handle-updating-the-latest-version-number-before-retrying-again/281738 "2021-08-17T18:20:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikram\_Golapelliwar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikram_golapelliwar/32/83243_2.png) [@Vikram\_Golapelliwar](https://discuss.elastic.co/u/Vikram_Golapelliwar)\
**Post date:** [August 17, 2021, 6:20pm UTC](https://discuss.elastic.co/t/does-retry-on-conflict-will-handle-updating-the-latest-version-number-before-retrying-again/281738/1 "2021-08-17T18:20:50Z")

</div>

Team, I have been trying to understand how setting retry\_on\_conflict will behave. It is little confusing in the documentation.

> **[Partial Updates to Documents | Elasticsearch: The Definitive Guide \[2.x\] |...](https://www.elastic.co/guide/en/elasticsearch/guide/current/partial-updates.html)**

As per my understanding, below lines suggest that the latest version update will be handled by retry\_on\_conflict

_To avoid losing data, the update API retrieves the current \_version of the document in the retrieve step, and passes that to the index request during the reindex step. If another process has changed the document between retrieve and reindex, then the \_version number won't match and the update request will fail._  
_For many uses of partial update, it doesn't matter that a document has been changed. For instance, if two processes are both incrementing the page-view counter, it doesn't matter in which order it happens; if a conflict occurs, the only thing we need to do is reattempt the update._

Whereas, Lines mentioned in subsequent paragraph says that the retry\_on\_conflict will ensure us to control the data loss.

_Like the index API, the update API adopts a last-write-wins approach by default, but it also accepts a version parameter that allows you to use optimistic concurrency control to specify which version of the document you intend to update._

My simple questions are

1. Whether the retry\_on\_conflict will update the version before reattempting the update? If not then how multiple retries will help? If yes then how the order of data updates will be maintained ?
2. Will there be any time gap between 2 retries b default? Is there a way to configure minimum wait time for next retry for more success ratio.

Thanks for reading my question. Please help me understand it further.

---

<div class="post-metadata">

**Author:** ![asgs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/asgs/32/35909_2.png) [@asgs](https://discuss.elastic.co/u/asgs)\
**Post date:** [August 20, 2021, 9:41am UTC](https://discuss.elastic.co/t/does-retry-on-conflict-will-handle-updating-the-latest-version-number-before-retrying-again/281738/2 "2021-08-20T09:41:22Z")

</div>

Hello, Elastic Team

any replies to the original post? I'm looking to find answers to those questions as well

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 17, 2021, 9:41am UTC](https://discuss.elastic.co/t/does-retry-on-conflict-will-handle-updating-the-latest-version-number-before-retrying-again/281738/3 "2021-09-17T09:41:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
