Refresh store stats

Hi,
I opened this issue in the ES github: https://github.com/elastic/elasticsearch/issues/36274
Shortly, I had this problem:

When I'm creating an index, I'm looking at the cat indices path with http;//localhost:9200/_cat/indices/<indexes> for the store.size which the index takes, and it's always takes only 324 bytes, thought after 10 seconds approximately the store.size is updated to the real storage size of the index.
I tried to flush the index, I tried to forcemerge the index and to refresh the index. nothing changed. The store.size only gets updated only after 10 seconds, no matter what.
Not only that, the _stats path of the index ( http;//localhost:9200/<indexes>/_stats ) also show the wrong storage size (in the store key).

I got this answer:

Elasticsearch caches store size and performs refresh
each index.store.stats_refresh_interval, which is exactly 10 seconds
by default. Consider changing this setting.

But I don't want to overload my easticsearch and want the refresh to occur only once, after I create the index.

Is there any REST request I can perform to update the store stats immediately after the index creation?

It looks like if you do something drastic like closing and reopening the index then the cached value is discarded, but otherwise I can't see how.

Why do you want to do know the exact size of an empty index just after creation?

Not after the index creation, I am sending in bulk the index docs.
I want to have a REST API call to refresh the stats right after this operation ends, so I won't have to wait this 10 seconds.

I see. No, I don't think this is possible. Note that the size of the index on disk is not a very well-defined concept, because of background activity like merges and refreshes and so on, so even if you disable caching by setting the refresh time to zero to get a completely up-to-date value it is not necessarily correct by the time it arrives at the client.

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