# Template not applied

**URL:** <https://discuss.elastic.co/t/template-not-applied/278757>\
**Category:** Elasticsearch\
**Created:** [July 15, 2021, 9:12am UTC](https://discuss.elastic.co/t/template-not-applied/278757 "2021-07-15T09:12:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anthonyrichir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anthonyrichir/32/28557_2.png) [@anthonyrichir](https://discuss.elastic.co/u/anthonyrichir)\
**Post date:** [July 15, 2021, 9:12am UTC](https://discuss.elastic.co/t/template-not-applied/278757/1 "2021-07-15T09:12:14Z")

</div>

Hello,

I have several pipelines running in a Logstash, they read messages from queues on a RabbitMQ and output those messages in rolling indices in an Elasticsearch.

For those indices, I have templates matching my index names, for instance.

```auto
GET _template

Result:
{
  ...
    "clicks_template": {
    "order": 0,
    "template": "[clicks-*]",
    "settings": {
      "index": {
        "number_of_shards": "1"
      }
    },
    "mappings": {
      "click": {
        "properties": {
          "uniqueVisitorId": {
            "type": "keyword"
          },
          "advertisementId": {
            "type": "keyword"
          },
          "campaignId": {
            "type": "keyword"
          },
          "lastUpdateOn": {
            "type": "date"
          },
          "timestamp": {
            "type": "date"
          },
          "publisherSpotReferenceId": {
            "type": "keyword"
          },
          "device": {
            "type": "keyword"
          },
          "userAgent": {
            "type": "text"
          },
          "ipAddress": {
            "type": "keyword"
          },
          "id": {
            "type": "text"
          }
        }
      }
    },
    "aliases": {}
  }
...
}

```

But If I query the settings of one of those indices, the number of shards is not right.

```auto
GET clicks_2021-07-15_idx/_settings

Result:
{
  "clicks_2021-07-15_idx": {
    "settings": {
      "index": {
        "creation_date": "1626308727528",
        "number_of_shards": "5",
        "number_of_replicas": "1",
        "uuid": "VGpag5DoSI6aCPQ1CeBwrQ",
        "version": {
          "created": "5061699"
        },
        "provided_name": "clicks_2021-07-15_idx"
      }
    }
  }
}

```

For which reason the template would not be applied ? Can I maybe change the default number of shards for the entire cluster ?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 15, 2021, 12:25pm UTC](https://discuss.elastic.co/t/template-not-applied/278757/2 "2021-07-15T12:25:02Z")

</div>

It looks as if you specified the template name wrong, by putting the `[]` array into the string. Try `"template": "clicks-*"` instead of `"template": "[clicks-*]"`.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![anthonyrichir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anthonyrichir/32/28557_2.png) [@anthonyrichir](https://discuss.elastic.co/u/anthonyrichir)\
**Post date:** [July 16, 2021, 8:07am UTC](https://discuss.elastic.co/t/template-not-applied/278757/3 "2021-07-16T08:07:12Z")

</div>

Thanks Alexander, the problem was there for months, way before I joined the project and nobody saw it.

---

<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:** [August 13, 2021, 8:07am UTC](https://discuss.elastic.co/t/template-not-applied/278757/4 "2021-08-13T08:07:39Z")

</div>

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