Template not applied

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.

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.

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 ?

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!

1 Like

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

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