When I do a forcemerge, I noticed shard size at first increases (as expected), and then later on decrease.
However, after the forcemerge task is finished, some of the shards are still larger; it takes some time for them to shrink again.
What is actually happening at that point? What data structures are responsible for the shard size? Note that the individual segments are already smaller, but the total of the segments doesn't add up to the shard size.
Some example.
Say that I start out with my_index
, containing 4 shards (2 primary, 2 replicas), that each have 10 5GB segments, with varying degrees of deleted documents. Now, after I do a forcemerge with only_expunge_deletes, I see for each shard still 10 segments, now varying from (say) 3 to 4,5 GB.
But when I query GET _cat/shards/my_index
, I may get shard sizes from 40 GB (expected) to 80 GB. Only after some time (several hours) does this converge to 4 shards of 40GB each.