# Relationship between request "refresh" and "refresh\_interval"

**URL:** <https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433>\
**Category:** Elasticsearch\
**Created:** [July 24, 2018, 5:41pm UTC](https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433 "2018-07-24T17:41:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Doman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_doman/32/11409_2.png) [@Thomas\_Doman](https://discuss.elastic.co/u/Thomas_Doman)\
**Post date:** [July 24, 2018, 5:41pm UTC](https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433/1 "2018-07-24T17:41:51Z")

</div>

The crux of my question is this: say I have my `refresh_interval` set to 60s and most of my indexing requests do not include `?refresh=true`. Then one single request comes through which **does** have refresh set to true. Does that cause everything to be refreshed?

In other words, is there any point in having most indexing operations not set refresh if there are regularly requests which do? Say, one every second, does that invalidate my `refresh_interval` of 60s?

---

<div class="post-metadata">

**Author:** ![nhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nhat/32/22170_2.png) [@nhat](https://discuss.elastic.co/u/nhat)\
**Post date:** [July 24, 2018, 7:38pm UTC](https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433/2 "2018-07-24T19:38:52Z")

</div>

> [@Thomas\_Doman](#):
>
> Then one single request comes through which **does** have refresh set to true. Does that cause everything to be refreshed?

@Thomas_Doman Correct, that request would refresh everything.

---

<div class="post-metadata">

**Author:** ![Thomas\_Doman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_doman/32/11409_2.png) [@Thomas\_Doman](https://discuss.elastic.co/u/Thomas_Doman)\
**Post date:** [July 24, 2018, 8:02pm UTC](https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433/3 "2018-07-24T20:02:29Z")

</div>

Thanks @nhat, so is the mixing the two is a bad idea? Since, if I had several thousand request **without** refresh set and then I make one **with** it set (within the period of my `refresh_interval`), the performance of that will request will incur the cost of the refresh wait time for all other non-refreshed requests. The aggregate wait time could be smaller but from the perspective of that request, it's a longer wait, correct?

---

<div class="post-metadata">

**Author:** ![nhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nhat/32/22170_2.png) [@nhat](https://discuss.elastic.co/u/nhat)\
**Post date:** [July 24, 2018, 8:24pm UTC](https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433/4 "2018-07-24T20:24:21Z")

</div>

@Thomas_Doman Why do you need to set refresh manually? Can you elaborate a bit on your use case? Thanks.

---

<div class="post-metadata">

**Author:** ![Thomas\_Doman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_doman/32/11409_2.png) [@Thomas\_Doman](https://discuss.elastic.co/u/Thomas_Doman)\
**Post date:** [July 24, 2018, 8:38pm UTC](https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433/5 "2018-07-24T20:38:12Z")

</div>

@nhat Sure, I have use cases where changes to a document need to be immediately reflected in search. For example, in our web app, users can take actions which add documents that need to be immediately reflected via search. Currently, because of that use case, all our requests are setting `?refresh=true`. However, we have many use cases where this would be optional where we're doing bulk loading of documents in the background throughout the day to the same indexes that don't need to be reflected immediately and these processes are the "heavy lifters" in our system. So, I'd hate to mix the two and impact a web app request due to the fact that thousands of documents were loaded behind the scenes. It'd be unpredictable when and how much impact that might have on any given request requiring `?refresh=true`.

---

<div class="post-metadata">

**Author:** ![nhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nhat/32/22170_2.png) [@nhat](https://discuss.elastic.co/u/nhat)\
**Post date:** [July 24, 2018, 9:29pm UTC](https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433/6 "2018-07-24T21:29:11Z")

</div>

@Thomas_Doman Setting `refresh=true` for the user requests makes sense in your use case. Do the newly indexed documents have to be visible in a search or can it be a realtime get instead?

---

<div class="post-metadata">

**Author:** ![Thomas\_Doman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_doman/32/11409_2.png) [@Thomas\_Doman](https://discuss.elastic.co/u/Thomas_Doman)\
**Post date:** [July 24, 2018, 9:39pm UTC](https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433/7 "2018-07-24T21:39:37Z")

</div>

@nhat Ah good point, but yes, the newly indexed documents have to be visible in a search. The pages are built based upon the same search both before and after the new documents are added. That is, after the new documents are added, the page is refreshed to reflect that change.

---

<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:** [August 21, 2018, 9:39pm UTC](https://discuss.elastic.co/t/relationship-between-request-refresh-and-refresh-interval/141433/8 "2018-08-21T21:39:41Z")

</div>

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