# How to apply ILM to entire matching index pattern?

**URL:** <https://discuss.elastic.co/t/how-to-apply-ilm-to-entire-matching-index-pattern/210784>\
**Category:** Beats\
**Tags:** ilm-index-lifecycle-management, filebeat\
**Created:** [December 5, 2019, 9:25pm UTC](https://discuss.elastic.co/t/how-to-apply-ilm-to-entire-matching-index-pattern/210784 "2019-12-05T21:25:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricJohnson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ericjohnson/32/53592_2.png) [@EricJohnson](https://discuss.elastic.co/u/EricJohnson)\
**Post date:** [December 5, 2019, 9:25pm UTC](https://discuss.elastic.co/t/how-to-apply-ilm-to-entire-matching-index-pattern/210784/1 "2019-12-05T21:25:41Z")

</div>

Hi.

I'd like to apply the same Index Lifecycle Management policy to all indices with a certain pattern. Specifically I need to do this for all of our beats {metricbeat-_, auditbeat-_, etc.}. I need to perform this task via the API and _not_ Kibana.

This does not work:

```
PUT _template/filebeat_rollover_template
{  
  "index_patterns": ["filebeat-*"],
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 1,
    "index.lifecycle.name": "beat_default_lifecycle_policy",
  }
}

```

Any suggestions?

Thank you!

---

<div class="post-metadata">

**Author:** ![EricJohnson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ericjohnson/32/53592_2.png) [@EricJohnson](https://discuss.elastic.co/u/EricJohnson)\
**Post date:** [December 5, 2019, 10:10pm UTC](https://discuss.elastic.co/t/how-to-apply-ilm-to-entire-matching-index-pattern/210784/2 "2019-12-05T22:10:04Z")

</div>

Here's the solution:

```
PUT filebeat*/_settings
{
  "lifecycle.name": "beat_default_lifecycle_policy"
}

```

I didn't see this page when I searched for it:  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/\_switching\_policies\_for\_an\_index.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/_switching_policies_for_an_index.html)

---

<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:** [January 2, 2020, 10:10pm UTC](https://discuss.elastic.co/t/how-to-apply-ilm-to-entire-matching-index-pattern/210784/3 "2020-01-02T22:10:31Z")

</div>

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