# Shrink Index - add 'shrink' as a suffix

**URL:** <https://discuss.elastic.co/t/shrink-index-add-shrink-as-a-suffix/182982>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [May 28, 2019, 5:00am UTC](https://discuss.elastic.co/t/shrink-index-add-shrink-as-a-suffix/182982 "2019-05-28T05:00:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [May 28, 2019, 5:00am UTC](https://discuss.elastic.co/t/shrink-index-add-shrink-as-a-suffix/182982/1 "2019-05-28T05:00:09Z")

</div>

Hi,

We recently enabled an `ILM` policy for our indices using the Kibana UI. We have enabled the `shrink` and `force merge` options as follows:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/a/ead35ed58b04315104d4f549b5bdfe35b4d6a8b3.png)

The issue is, after rollover, the index (`my-index-00001`) is named as `shrink-my-index-00001`. Is it possible to specify the name of the new shrunk index in ILM? Otherwise. I will have to change my index patterns, visualizations and dashboards cause the new pattern would be `*my-index-*`, instead of the current pattern `my-index-*`.

Also, what is the optimum number of segments that I should specify during the force merge operation?

Cheers!

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [May 28, 2019, 3:04pm UTC](https://discuss.elastic.co/t/shrink-index-add-shrink-as-a-suffix/182982/2 "2019-05-28T15:04:37Z")

</div>

> [@NerdSec](#):
>
> Is it possible to specify the name of the new shrunk index in ILM? Otherwise. I will have to change my index patterns, visualizations and dashboards cause the new pattern would be `*my-index-*` , instead of the current pattern `my-index-*` .

No, it's not possible currently to change the name of the shrunken index.

As for querying it though, when ILM shrinks an index it _does_ create an alias for the index with the same name as the previous one, so `my-index-000001` becomes `shrink-my-index-000001` and an alias is created called `my-index-000001` pointing to the new shrink-prefixed index.

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [May 28, 2019, 3:05pm UTC](https://discuss.elastic.co/t/shrink-index-add-shrink-as-a-suffix/182982/3 "2019-05-28T15:05:55Z")

</div>

> [@NerdSec](#):
>
> Also, what is the optimum number of segments that I should specify during the force merge operation?

This will depend on how large the shard is, and how many indices you have in your cluster. A fully force merged index is one with a single segment, but you may want to keep more segments around if the shard is really huge (100s of gigabytes).

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [May 29, 2019, 5:16am UTC](https://discuss.elastic.co/t/shrink-index-add-shrink-as-a-suffix/182982/4 "2019-05-29T05:16:04Z")

</div>

> [@dakrone](#):
>
> an alias is created called `my-index-000001` pointing to the new shrink-prefixed index.

That's great. So, does that mean that my existing index pattern of `my-index-*` will work for the shrunk index too, right?

This would save me the trouble of reworking my dashboards and visualizations. 😃

---

<div class="post-metadata">

**Author:** ![NerdSec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nerdsec/32/22056_2.png) [@NerdSec](https://discuss.elastic.co/u/NerdSec)\
**Post date:** [May 29, 2019, 5:19am UTC](https://discuss.elastic.co/t/shrink-index-add-shrink-as-a-suffix/182982/5 "2019-05-29T05:19:48Z")

</div>

> [@dakrone](#):
>
> if the shard is really huge (100s of gigabytes).

So, we currently have around 100-150 indices in the cluster, and we are aiming to keep the shard size to around **40GB**. So we have around 3 shards of 40GB each for our shrunk indices.

Does that mean a fully force merged index will give me better read/search operations?

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [May 29, 2019, 5:02pm UTC](https://discuss.elastic.co/t/shrink-index-add-shrink-as-a-suffix/182982/6 "2019-05-29T17:02:37Z")

</div>

> [@NerdSec](#):
>
> So, does that mean that my existing index pattern of `my-index-*` will work for the shrunk index too, right?

Yes that's correct.

> [@NerdSec](#):
>
> we are aiming to keep the shard size to around **40GB**.

Okay, for a 40gb shard you should be completely fine to fully force merge it to a single segment.

---

<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:** [June 26, 2019, 5:02pm UTC](https://discuss.elastic.co/t/shrink-index-add-shrink-as-a-suffix/182982/7 "2019-06-26T17:02:37Z")

</div>

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