Max_num_segments is not working for forcemerge

All,

I am going to do force merge for one of index (4 primary shard and 0 replica). To reduce the IO impact, I'd like to merge into 4 segments for each shard. So I use following command,

POST /rms_pl_03-viewer-cdr-invite-2020040518/_forcemerge?max_num_segments=4

After merge is done, we can see each shard is merged to 1 segment rather than 4. My Elasticsaech version is 6.5. Could you please let me know why is seems like max_num_segments=4 is not working ? Thanks much in advanced.

index shard size generation docs.count size.memory docs.deleted committed searchable compound
rms_pl_03-viewer-cdr-invite-2020040518 0 3.8gb 259 1921532 8179330 0 true true false
rms_pl_03-viewer-cdr-invite-2020040518 1 3.7gb 288 1864142 7988849 0 true true false
rms_pl_03-viewer-cdr-invite-2020040518 2 3.7gb 274 1854965 7968941 0 true true false
rms_pl_03-viewer-cdr-invite-2020040518 3 3.7gb 260 1859372 7967752 0 true true false

Thanks,
Jill

Is that because max_num_segments only define the max number segments not the accurate number segments per shard ?

In other word, the actual number of segment per shard after force merge cannot be defined.

If it is true, would you please help understand why and what is algorithm for force merge ?

Yes, max_num_segments is a maximum not a target and you may get fewer segments than requested if it makes more sense to do so. I am guessing you end up with one segment since these shards are rather small, just a few GB.

Thanks much. But would you please let me know in which situation multiple segments will be generated after force merge ? 5G per shard ? and how force merge works ?

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