How to apply ILM to entire matching index pattern?

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!

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

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