# Index size in bytes is not updated even after \_refresh and \_flush/synced

**URL:** <https://discuss.elastic.co/t/index-size-in-bytes-is-not-updated-even-after-refresh-and-flush-synced/161634>\
**Category:** Elasticsearch\
**Created:** [December 20, 2018, 7:33am UTC](https://discuss.elastic.co/t/index-size-in-bytes-is-not-updated-even-after-refresh-and-flush-synced/161634 "2018-12-20T07:33:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsarkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bsarkar/32/42967_2.png) [@bsarkar](https://discuss.elastic.co/u/bsarkar)\
**Post date:** [December 20, 2018, 7:33am UTC](https://discuss.elastic.co/t/index-size-in-bytes-is-not-updated-even-after-refresh-and-flush-synced/161634/1 "2018-12-20T07:33:26Z")

</div>

We have some tests which query the index size from Elasticsearch and perform some validations on it. This validation is flaky - it does not pass always. Below is the reproduction:  
Execute all commands below in one go:

> PUT idx1  
> PUT idx1/t1/1  
> {  
> "name": "foo"  
> }  
> PUT idx1/t1/2  
> {  
> "name": "bar"  
> }  
> POST idx1/\_refresh  
> POST idx1/\_flush/synced  
> GET idx1/\_stats/store,docs,indexing?filter\_path=indices

In the response of the last command, value of `"indices.idx1.primaries.store.size_in_bytes`" is `261`. If I execute the last command repeatedly for a few seconds, it eventually increases and settles at `7793`. Funny thing is if I delete the index `idx1` and execute all the commands above, I get the value `7793` in the very first attempt. If I repeat this with a new index name, the bug reproduces. This leads me to believe there is some caching going on in the background. I want to know if there a way to get to the final state reliably and synchronously instead of polling. Maybe I need to execute more commands. Please help.

---

<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:** [January 17, 2019, 7:33am UTC](https://discuss.elastic.co/t/index-size-in-bytes-is-not-updated-even-after-refresh-and-flush-synced/161634/2 "2019-01-17T07:33:28Z")

</div>

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