# Applying best compression on already force-merged indices

**URL:** <https://discuss.elastic.co/t/applying-best-compression-on-already-force-merged-indices/308552>\
**Category:** Elasticsearch\
**Created:** [June 30, 2022, 9:52am UTC](https://discuss.elastic.co/t/applying-best-compression-on-already-force-merged-indices/308552 "2022-06-30T09:52:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandeepkanabar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepkanabar/32/79399_2.png) [@sandeepkanabar](https://discuss.elastic.co/u/sandeepkanabar)\
**Post date:** [June 30, 2022, 9:52am UTC](https://discuss.elastic.co/t/applying-best-compression-on-already-force-merged-indices/308552/1 "2022-06-30T09:52:47Z")

</div>

Hi All,

Have a question related to applying `best_compression` on indices that are **already force-merged to 1 segment**.

My question is: Can i _still apply best\_compression_ on them to save some disk space?

I suppose I can `close`, apply `b_c` and then `open` them.

While this [post](https://discuss.elastic.co/t/enforcing-best-compression-on-already-optimized-indices/56140/4) says that this should work, another [post](https://discuss.elastic.co/t/apply-best-compression-to-save-disk-space/289705/2) says in order for `b_c` to be effected, they need to be force-merged. Since my indices are **already** force-merged, I'm doubtful if applying `b_c` will have any benefits?

Can someone clarify please.

Thanks.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 30, 2022, 9:58am UTC](https://discuss.elastic.co/t/applying-best-compression-on-already-force-merged-indices/308552/2 "2022-06-30T09:58:33Z")

</div>

As segments are immutable I do believe you will need to forcemerge again. If you are already down to a single segment I suspect this would be a no-op, so you _may_ need to add a dummy document that you then delete in order to create another segment.

---

<div class="post-metadata">

**Author:** ![sandeepkanabar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepkanabar/32/79399_2.png) [@sandeepkanabar](https://discuss.elastic.co/u/sandeepkanabar)\
**Post date:** [June 30, 2022, 11:02am UTC](https://discuss.elastic.co/t/applying-best-compression-on-already-force-merged-indices/308552/3 "2022-06-30T11:02:39Z")

</div>

Thanks Christian, as always, for being so helpful. A question: The recommendation is to never write to force-merged indices since force-merging is done only on RO indices. Or that **we can write at times**? I remember doing exactly what you mentioned a while back but not sure if this is recommended.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 30, 2022, 11:10am UTC](https://discuss.elastic.co/t/applying-best-compression-on-already-force-merged-indices/308552/4 "2022-06-30T11:10:14Z")

</div>

> [@sandeepkanabar](#):
>
> The recommendation is to never write to force-merged indices

This is correct as it removes some of the benefits of forcemerging. Normally you should apply best\_compression before forcemerging, so the approach I provided is merely a workaround in order to get the best\_compression to apply.

---

<div class="post-metadata">

**Author:** ![sandeepkanabar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepkanabar/32/79399_2.png) [@sandeepkanabar](https://discuss.elastic.co/u/sandeepkanabar)\
**Post date:** [June 30, 2022, 12:08pm UTC](https://discuss.elastic.co/t/applying-best-compression-on-already-force-merged-indices/308552/5 "2022-06-30T12:08:42Z")

</div>

Thanks Christian. That clarifies.

---

<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:** [July 28, 2022, 12:09pm UTC](https://discuss.elastic.co/t/applying-best-compression-on-already-force-merged-indices/308552/6 "2022-07-28T12:09:14Z")

</div>

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