# ILM, shrink index and aliases

**URL:** <https://discuss.elastic.co/t/ilm-shrink-index-and-aliases/281755>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management, datastreams\
**Created:** [August 18, 2021, 1:18am UTC](https://discuss.elastic.co/t/ilm-shrink-index-and-aliases/281755 "2021-08-18T01:18:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Russell\_Fulton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/russell_fulton/32/62888_2.png) [@Russell\_Fulton](https://discuss.elastic.co/u/Russell_Fulton)\
**Post date:** [August 18, 2021, 1:18am UTC](https://discuss.elastic.co/t/ilm-shrink-index-and-aliases/281755/1 "2021-08-18T01:18:13Z")

</div>

Is there a way to get ES to retain aliases of indexes after the index has been shrunk during an ILM rollover. I use the aliases in the kibana discover indexes rather than index name patterns but the new shrunk indexes have lost their aliases

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 18, 2021, 1:43am UTC](https://discuss.elastic.co/t/ilm-shrink-index-and-aliases/281755/2 "2021-08-18T01:43:23Z")

</div>

From [the docs](https://www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-shrink.html);

> After the `shrink` action, any aliases that pointed to the source index point to the new shrunken index.

So you shouldn't see the aliases being removed at all?

---

<div class="post-metadata">

**Author:** ![Russell\_Fulton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/russell_fulton/32/62888_2.png) [@Russell\_Fulton](https://discuss.elastic.co/u/Russell_Fulton)\
**Post date:** [August 18, 2021, 2:09am UTC](https://discuss.elastic.co/t/ilm-shrink-index-and-aliases/281755/3 "2021-08-18T02:09:31Z")

</div>

That's what I expected.

A bit more digging and I think the issue is that it is a data stream, which does not allow aliases _but_ when you create a kibana index pattern it lists the datastream name as an "alias"! which is confusing to say the least.

If you shrink an index which is part of the data stream the kibana index pattern no longer matches the shrunk index : (

I had to make a new index pattern which is ugly

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 18, 2021, 2:28am UTC](https://discuss.elastic.co/t/ilm-shrink-index-and-aliases/281755/4 "2021-08-18T02:28:18Z")

</div>

AFAIK that shouldn't be the case with datastreams, it should be able to handle that. I'll add the `datastreams` tag and see if one of the eng folk from that team can comment,

---

<div class="post-metadata">

**Author:** ![Russell\_Fulton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/russell_fulton/32/62888_2.png) [@Russell\_Fulton](https://discuss.elastic.co/u/Russell_Fulton)\
**Post date:** [August 18, 2021, 8:07pm UTC](https://discuss.elastic.co/t/ilm-shrink-index-and-aliases/281755/5 "2021-08-18T20:07:56Z")

</div>

BTW I just realised that I first noticed this after upgrading to 7.14.0!

---

<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:** [September 15, 2021, 8:08pm UTC](https://discuss.elastic.co/t/ilm-shrink-index-and-aliases/281755/6 "2021-09-15T20:08:47Z")

</div>

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