# Detecting if an index is refreshing

**URL:** https://discuss.elastic.co/t/detecting-if-an-index-is-refreshing/86828
**Category:** Elasticsearch
**Created:** [May 23, 2017, 3:08pm UTC](https://discuss.elastic.co/t/detecting-if-an-index-is-refreshing/86828 "2017-05-23T15:08:35Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mortenbock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mortenbock/32/13062_2.png) [@mortenbock](https://discuss.elastic.co/u/mortenbock)
#### Post date: [May 23, 2017, 3:08pm UTC](https://discuss.elastic.co/t/detecting-if-an-index-is-refreshing/86828/1 "2017-05-23T15:08:35Z")

</div>

While indexing our product catalog, we set the RefreshInterval to -1, as long as we are bulk updating the index.

When we are done, we set it back to 1 second.

After that, I would like to poll the index to see when it is done "refreshing" the index, so that I can safely swap the alias from the old index to the new index, without any issues.

Is there a way to do that?

---

<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: [May 23, 2017, 3:22pm UTC](https://discuss.elastic.co/t/detecting-if-an-index-is-refreshing/86828/2 "2017-05-23T15:22:57Z")

</div>

Why not calling actually `_refresh` endpoint?

---

<div class="post-metadata">

### Author: ![mortenbock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mortenbock/32/13062_2.png) [@mortenbock](https://discuss.elastic.co/u/mortenbock)
#### Post date: [May 23, 2017, 3:38pm UTC](https://discuss.elastic.co/t/detecting-if-an-index-is-refreshing/86828/3 "2017-05-23T15:38:07Z")

</div>

Is that a synchronous call? So it will not return until refresh is completed?

---

<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: [May 23, 2017, 3:39pm UTC](https://discuss.elastic.co/t/detecting-if-an-index-is-refreshing/86828/4 "2017-05-23T15:39:19Z")

</div>

Yes it is.

---

<div class="post-metadata">

### Author: ![mortenbock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mortenbock/32/13062_2.png) [@mortenbock](https://discuss.elastic.co/u/mortenbock)
#### Post date: [May 23, 2017, 3:42pm UTC](https://discuss.elastic.co/t/detecting-if-an-index-is-refreshing/86828/5 "2017-05-23T15:42:27Z")

</div>

My only concern would be, what if it takes a long time to complete the refresh? The call might time out, and then I'd have to trigger a new refresh, which might just make it worse?

---

<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: [May 23, 2017, 4:09pm UTC](https://discuss.elastic.co/t/detecting-if-an-index-is-refreshing/86828/6 "2017-05-23T16:09:09Z")

</div>

Did you give it a try? Should not take that long IMHO.

---

<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: [June 20, 2017, 4:09pm UTC](https://discuss.elastic.co/t/detecting-if-an-index-is-refreshing/86828/7 "2017-06-20T16:09:10Z")

</div>

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