# \[v 7.17\] Component Template Alias not working

**URL:** <https://discuss.elastic.co/t/v-7-17-component-template-alias-not-working/356331>\
**Category:** Elasticsearch\
**Created:** [March 27, 2024, 7:46pm UTC](https://discuss.elastic.co/t/v-7-17-component-template-alias-not-working/356331 "2024-03-27T19:46:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![parosio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/parosio/32/27367_2.png) [@parosio](https://discuss.elastic.co/u/parosio)\
**Post date:** [March 27, 2024, 7:46pm UTC](https://discuss.elastic.co/t/v-7-17-component-template-alias-not-working/356331/1 "2024-03-27T19:46:35Z")

</div>

Hello,  
I needed to update a legacy template to add an alias, but the operation fails (legacy template are deprecated).

I created a set of components to replicate the existing template

 ![Component_Templates_01](https://us1.discourse-cdn.com/elastic/original/3X/1/1/11a52781406234a2c83aa568a4ea1c149fd17ae6.png)

then included them in a new index template:  
 ![Component_Templates_02](https://us1.discourse-cdn.com/elastic/original/3X/9/3/936a5cdd9fb4e5ca34e0bafdbd61e4f831a54cd8.png)

The Request is:

```auto
PUT _index_template/tptt_eni_tp_test_new
{
  "index_patterns": [
    "eni-test-tp*"
  ],
  "composed_of": [
    "cptt_eni_test_settings",
    "cptt_eni_tp_mapping",
    "cptt_eni_tp_aliases"
  ]
}

```

but the preview does not contain the aliases from the alias component:

```auto
{
  "template": {
    "settings": {
      "index": {
        "number_of_shards": "2",
        "number_of_replicas": "0"
      }
    },
    "mappings": {
      "dynamic_templates": [],
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "Attack_Type": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
[... cut ...]
        "subsidiary": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "uploadTime": {
          "type": "date",
          "format": "yyyy/MM/dd HH:mm:ss.SSS"
        }
      }
    },
    "aliases": {}
  }
}

```

The alias component seems fine:

```auto
GET _component_template/cptt_eni_tp_aliases

{
  "component_templates" : [
    {
      "name" : "cptt_eni_tp_aliases",
      "component_template" : {
        "template" : {
          "aliases" : {
            "eni-tp-subs-angola" : {
              "filter" : {
                "term" : {
                  "subsidiary.keyword" : "angola"
                }
              }
            },
[... cut ...]
            "eni-tp-subs-kenya" : {
              "filter" : {
                "term" : {
                  "subsidiary.keyword" : "kenya"
                }
 } } } } } }
  ]
}

```

When a document is posted to a new index like `eni-test-tp.test-component` the settings and mappings are correct, but it has none of the expected aliases.

The only solution I found is to add the alias section during the index\_template creation itself, as the composition seems rejecting the alias component.

Am I doing something wrong?

Regards,  
Paolo

---

<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 24, 2024, 7:47pm UTC](https://discuss.elastic.co/t/v-7-17-component-template-alias-not-working/356331/2 "2024-04-24T19:47:16Z")

</div>

Closed on April 24, 2024, 7:47pm UTC

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