Rollover max_size precision

I am seeing an interesting behavior on Rollover Index.
When "max_size" is given with little bit smaller than the current index size, sometimes (or some indices) the rollover succeeds sometime it fails.
For example, the current index size 2682mb and rollover "max_size" condition is given as 2500mb.

Is this an expected behavior? Any explanation?

I use this API to get the index current size:

GET /_cat/indices/myIndex*?h=index,pri.store.size&bytes=m

Curl command example:

POST /myIndex/_rollover
{
"conditions": {
"max_size": "2500mb"
},
"settings" :
{
"index.number_of_shards" : 5
}
}

Elasticsearch version: 6.8
I don't use any other condition.
I am adding more documents on indices so they are growing; I check the current size first before sending the Rollover API.

Thanks in advance,

Did little study on the ES source code and I see _cat and rollover API (condition check) use different stats - one is from lucene store directory and one is from lucene segment.
That might explain this issue b/c two stats may be different.
It would be good if someone know why they use different stats, if my observation is correct. And/or any suggested ES API to get stats from lucene segment (the stats that rollover uses).

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