# Index template - index pattern does not match index name

**URL:** <https://discuss.elastic.co/t/index-template-index-pattern-does-not-match-index-name/237445>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [June 17, 2020, 10:01am UTC](https://discuss.elastic.co/t/index-template-index-pattern-does-not-match-index-name/237445 "2020-06-17T10:01:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dorinand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorinand/32/70521_2.png) [@dorinand](https://discuss.elastic.co/u/dorinand)\
**Post date:** [June 17, 2020, 10:02am UTC](https://discuss.elastic.co/t/index-template-index-pattern-does-not-match-index-name/237445/1 "2020-06-17T10:02:00Z")

</div>

I am playing with roolover of indices via [ILM](https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index-lifecycle-management.html). I created index template for all `printmessage_charizard_1` indices:

```auto
    {
      "order": 0,
      "index_patterns": [
        "printmessage_charizard_1-*"
      ],
      "settings": {
        "index": {
          "lifecycle": {
            "name": "my_policy1",
            "rollover_alias": "charizard"
          },
          "number_of_shards": "2",
          "number_of_replicas": "1"
        }
      },
      "mappings": {},
      "aliases": {}
    }

```

When I send data from logstash, new index is created named `printmessage_charizard_1` but it did not have 2 shards. It use default template, 1 shard, 1 replica. When I try the same queries with example from ILM (mentionet above), it works:

```auto
{
  "order": 0,
  "index_patterns": [
    "datastream-*"
  ],
  "settings": {
    "index": {
      "lifecycle": {
        "name": "datastream_policy",
        "rollover_alias": "datastream"
      },
      "number_of_shards": "1",
      "number_of_replicas": "0"
    }
  },
  "mappings": {},
  "aliases": {}
}

```

If I change index pattern to:

```auto
{
  "order": 0,
  "index_patterns": [
    "printmessage_chariz*"
  ],
  "settings": {
    "index": {
      "lifecycle": {
        "name": "my_policy1",
        "rollover_alias": "charizard"
      },
      "number_of_shards": "2",
      "number_of_replicas": "1"
    }
  },
  "mappings": {},
  "aliases": {}
}

```

It will match it template partly. It will create `printmessage_charizard_1` index with two shards and one replica, but it does not use rollover\_alias. So I have there two indices `printmessage_charizard_1` - without alias, full of my logs, and `printmessage_charizard_1-000001` with alias and empty.

1. What does I missing, why does my pattern does not match/or just partly match charizard index?
2. Why does it work with datastream index?
3. I would expect that star (\*) would match any chars.

---

<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:** [July 15, 2020, 10:02am UTC](https://discuss.elastic.co/t/index-template-index-pattern-does-not-match-index-name/237445/2 "2020-07-15T10:02:05Z")

</div>

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