# Clarification on multiple indices

**URL:** <https://discuss.elastic.co/t/clarification-on-multiple-indices/268705>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [March 29, 2021, 9:05pm UTC](https://discuss.elastic.co/t/clarification-on-multiple-indices/268705 "2021-03-29T21:05:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amphagory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amphagory/32/46127_2.png) [@Amphagory](https://discuss.elastic.co/u/Amphagory)\
**Post date:** [March 29, 2021, 9:05pm UTC](https://discuss.elastic.co/t/clarification-on-multiple-indices/268705/1 "2021-03-29T21:05:16Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

**Author:** ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)\
**Post date:** [March 29, 2021, 11:17pm UTC](https://discuss.elastic.co/t/clarification-on-multiple-indices/268705/2 "2021-03-29T23:17:59Z")

</div>

Looks good.  
What is you doubt?

---

<div class="post-metadata">

**Author:** ![Amphagory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amphagory/32/46127_2.png) [@Amphagory](https://discuss.elastic.co/u/Amphagory)\
**Post date:** [March 30, 2021, 3:18am UTC](https://discuss.elastic.co/t/clarification-on-multiple-indices/268705/3 "2021-03-30T03:18:54Z")

</div>

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

```auto
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

---

<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:** [April 27, 2021, 3:19am UTC](https://discuss.elastic.co/t/clarification-on-multiple-indices/268705/4 "2021-04-27T03:19:27Z")

</div>

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