# ILM policy based on index and not on index template

**URL:** <https://discuss.elastic.co/t/ilm-policy-based-on-index-and-not-on-index-template/296123>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [February 2, 2022, 8:25pm UTC](https://discuss.elastic.co/t/ilm-policy-based-on-index-and-not-on-index-template/296123 "2022-02-02T20:25:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![srk1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srk1/32/88697_2.png) [@srk1](https://discuss.elastic.co/u/srk1)\
**Post date:** [February 2, 2022, 8:25pm UTC](https://discuss.elastic.co/t/ilm-policy-based-on-index-and-not-on-index-template/296123/1 "2022-02-02T20:25:54Z")

</div>

Hi,  
Is there a way to configure ILM policy specific to index and not based on index template? it is annoying to have multiple templates and specifying index patterns for each type (daily, monthly, yearly). If i want to implement ILM policy for a specific index, i have to create a template and can't use default template. If i have 10 different daily indices, should i have different 10 different index templates to apply ILM? Using wild card on new template is also not helping since the ILM policy is getting applied to all newly created indices which are not just daily.  
Can someone from ES suggest here?

Thanks,  
SRK.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 2, 2022, 8:30pm UTC](https://discuss.elastic.co/t/ilm-policy-based-on-index-and-not-on-index-template/296123/2 "2022-02-02T20:30:02Z")

</div>

You can set directly on an index when you create it.  
Notice is says

> These index-level ILM settings are typically configured through index templates

But you can set manually on a specific index upon creation as well

See Here

> **[Index lifecycle management settings in Elasticsearch | Elasticsearch Guide...](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-settings.html#_index_level_settings)**

---

<div class="post-metadata">

**Author:** ![srk1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srk1/32/88697_2.png) [@srk1](https://discuss.elastic.co/u/srk1)\
**Post date:** [February 2, 2022, 8:39pm UTC](https://discuss.elastic.co/t/ilm-policy-based-on-index-and-not-on-index-template/296123/3 "2022-02-02T20:39:41Z")

</div>

Hi,  
Thanks for quick reply. My indices are created via logtsash and i am looking for something that the ILM policy is applied during the time of index creation and obviously not through index template since all my indices uses default template. I couldn't find such on the documentation provided. please let me know how it is done.

Thank you,  
SRK.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 2, 2022, 8:48pm UTC](https://discuss.elastic.co/t/ilm-policy-based-on-index-and-not-on-index-template/296123/4 "2022-02-02T20:48:08Z")

</div>

Did you look at [this](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-ilm_policy)?

---

<div class="post-metadata">

**Author:** ![srk1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srk1/32/88697_2.png) [@srk1](https://discuss.elastic.co/u/srk1)\
**Post date:** [February 2, 2022, 8:49pm UTC](https://discuss.elastic.co/t/ilm-policy-based-on-index-and-not-on-index-template/296123/5 "2022-02-02T20:49:04Z")

</div>

So it can't be applied automatically? Like specifying the ILM policy in logstash output config while index is being created?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 2, 2022, 8:51pm UTC](https://discuss.elastic.co/t/ilm-policy-based-on-index-and-not-on-index-template/296123/6 "2022-02-02T20:51:49Z")

</div>

Perhaps we typed at the same time, I think exactly what you are looking for...

> **[Elasticsearch output plugin | Logstash Reference \[8.11\] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-ilm_policy)**

> #### `ilm_policy`
> 
> - Value type is [string](https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html#string)
> - Default value is `logstash-policy`
> 
> Modify this setting to use a custom Index Lifecycle Management policy, rather than the default. If this value is not set, the default policy will be automatically installed into Elasticsearch
> 
> If this setting is specified, the policy must already exist in Elasticsearch cluster.

---

<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:** [March 2, 2022, 8:52pm UTC](https://discuss.elastic.co/t/ilm-policy-based-on-index-and-not-on-index-template/296123/7 "2022-03-02T20:52:47Z")

</div>

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