# Understand async and wait\_for mode

**URL:** <https://discuss.elastic.co/t/understand-async-and-wait-for-mode/299939>\
**Category:** Elasticsearch\
**Created:** [March 17, 2022, 10:51am UTC](https://discuss.elastic.co/t/understand-async-and-wait-for-mode/299939 "2022-03-17T10:51:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Remy\_Letient](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remy_letient/32/48128_2.png) [@Remy\_Letient](https://discuss.elastic.co/u/Remy_Letient)\
**Post date:** [March 17, 2022, 10:51am UTC](https://discuss.elastic.co/t/understand-async-and-wait-for-mode/299939/1 "2022-03-17T10:51:50Z")

</div>

Hi,

A question about the async mode (when I don't specify the option 'refresh=wait\_for') and when I specify.  
Qeustion: in the same index I have 2 documents: 'A' and 'B'.  
If I update the document 'A' with no refresh option and just after, in the same thread(java), I update the document 'B' with the option 'refresh=wait\_for', when I have the update response for B, Can I consider that the 'index process' for document 'A' is also finished ? (We expect the fact that an error can occurs for the document 'A')

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [March 17, 2022, 1:39pm UTC](https://discuss.elastic.co/t/understand-async-and-wait-for-mode/299939/2 "2022-03-17T13:39:24Z")

</div>

> [@Remy\_Letient](#):
>
> Can I consider that the 'index process' for document 'A' is also finished ?

It depends. `?refresh=wait_for` ensures that all successfully-completed writes to affected shards are now visible, but there's no guarantee that document A is in one of those shards.

---

<div class="post-metadata">

**Author:** ![Remy\_Letient](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remy_letient/32/48128_2.png) [@Remy\_Letient](https://discuss.elastic.co/u/Remy_Letient)\
**Post date:** [March 17, 2022, 3:14pm UTC](https://discuss.elastic.co/t/understand-async-and-wait-for-mode/299939/3 "2022-03-17T15:14:33Z")

</div>

Ok understood, it makes sense.  
Thank you.

---

<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:** [April 14, 2022, 3:15pm UTC](https://discuss.elastic.co/t/understand-async-and-wait-for-mode/299939/4 "2022-04-14T15:15:07Z")

</div>

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