Clarification on multiple indices

I'm new to creating ILM on Elasticsearch version 7.3.2 and have a noob question as follow:

The setup: I have two indices index_a & index_b, I want to use the same index lifecycle policy.

The question: Wouild I create a template for each? Say as follows:

PUT _template/index_a_template
{
  "index_patterns": [
    "index_a*"
  ],
  "settings": {
    "number_of_shards": 1,
    "index": {
      "lifecycle": {
        "name": "generic_lifecycle",
        "rollover_alias": "index_a"
      }
    }
  }
...

and

PUT _template/index_b_template
{
  "index_patterns": [
    "index_b*"
  ],
  "settings": {
    "number_of_shards": 1,
    "index": {
      "lifecycle": {
        "name": "generic_lifecycle",
        "rollover_alias": "index_b"
      }
    }
  }
...

thanks for you help,

Mike

Looks good.
What is you doubt?

I was just making sure I was doing it right... I was wondering if there was a single command like:

PUT _template/index_a_b_template
{
  "index_patterns": [
    "index_a*, index_b*"
  ],
  "settings": {
    "number_of_shards": 1,
    "index": {
      "lifecycle": {
        "name": "generic_lifecycle",
        "rollover_alias1": "index_a",
        "rollover_alias1": "index_b"
      }
    }
  }

Good to know you are suppose to create 2 templates.

Thanks,
Mike

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