# 'Refresh' setting for a bulk update request

**URL:** <https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [January 28, 2022, 12:21am UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641 "2022-01-28T00:21:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kaushik\_Lingarkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaushik_lingarkar/32/100982_2.png) [@Kaushik\_Lingarkar](https://discuss.elastic.co/u/Kaushik_Lingarkar)\
**Post date:** [January 28, 2022, 12:21am UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641/1 "2022-01-28T00:21:09Z")

</div>

Hello all,

This is my first post here and thank you for this amazing tool.

I am using the Elasticsearch-rest-client and I wanted a clarification with the behaviour of Refresh setting with the Bulk API.

Does the 'refresh=true' parameter ensure that any reads done immediately after the write request(performed using [performRequest](https://artifacts.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client/7.8.1/org/elasticsearch/client/RestClient.html#performRequest(org.elasticsearch.client.Request))) has returned will indeed return the new data?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 28, 2022, 5:57am UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641/2 "2022-01-28T05:57:29Z")

</div>

The refresh happens synchronously.

What I prefer doing though is to call explicitly the refresh API after the execution of the index operations.

---

<div class="post-metadata">

**Author:** ![Kaushik\_Lingarkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaushik_lingarkar/32/100982_2.png) [@Kaushik\_Lingarkar](https://discuss.elastic.co/u/Kaushik_Lingarkar)\
**Post date:** [January 28, 2022, 4:22pm UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641/3 "2022-01-28T16:22:47Z")

</div>

Thanks for your reply. May I ask, which use-cases the explicit call to refresh are meant to handle if refresh=true does indeed happen synchronously before the write request is returned?

---

<div class="post-metadata">

**Author:** ![Kaushik\_Lingarkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaushik_lingarkar/32/100982_2.png) [@Kaushik\_Lingarkar](https://discuss.elastic.co/u/Kaushik_Lingarkar)\
**Post date:** [January 28, 2022, 4:45pm UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641/4 "2022-01-28T16:45:47Z")

</div>

Apologies, I edited my question now to use better wording.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 28, 2022, 6:04pm UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641/5 "2022-01-28T18:04:03Z")

</div>

Just for the clarity of my code. And I'm only doing that in integration tests. Never in production.

---

<div class="post-metadata">

**Author:** ![Kaushik\_Lingarkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaushik_lingarkar/32/100982_2.png) [@Kaushik\_Lingarkar](https://discuss.elastic.co/u/Kaushik_Lingarkar)\
**Post date:** [January 31, 2022, 4:59pm UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641/6 "2022-01-31T16:59:12Z")

</div>

@dadoonet May I request that you please take a look at my edited question? It will be really helpful if you can help answer it.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 31, 2022, 6:11pm UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641/7 "2022-01-31T18:11:56Z")

</div>

> [@Kaushik\_Lingarkar](#):
>
> Does the 'refresh=true' parameter ensure that any reads done immediately after the write request(performed using [performRequest](https://artifacts.elastic.co/javadoc/org/elasticsearch/client/elasticsearch-rest-client/7.8.1/org/elasticsearch/client/RestClient.html#performRequest(org.elasticsearch.client.Request))) has returned will indeed return the new data?

Yes it will.

---

<div class="post-metadata">

**Author:** ![Kaushik\_Lingarkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaushik_lingarkar/32/100982_2.png) [@Kaushik\_Lingarkar](https://discuss.elastic.co/u/Kaushik_Lingarkar)\
**Post date:** [January 31, 2022, 9:22pm UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641/8 "2022-01-31T21:22:29Z")

</div>

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:** [February 28, 2022, 9:23pm UTC](https://discuss.elastic.co/t/refresh-setting-for-a-bulk-update-request/295641/9 "2022-02-28T21:23:02Z")

</div>

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