# Index template - adding multiple aliases

**URL:** <https://discuss.elastic.co/t/index-template-adding-multiple-aliases/227171>\
**Category:** Elasticsearch\
**Created:** [April 8, 2020, 4:01pm UTC](https://discuss.elastic.co/t/index-template-adding-multiple-aliases/227171 "2020-04-08T16:01:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wedkarz014](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wedkarz014/32/48935_2.png) [@wedkarz014](https://discuss.elastic.co/u/wedkarz014)\
**Post date:** [April 8, 2020, 4:01pm UTC](https://discuss.elastic.co/t/index-template-adding-multiple-aliases/227171/1 "2020-04-08T16:01:08Z")

</div>

Hi,  
I have ES 6.8.3, I want to set multiple aliases in index template but i have an error:

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Root mapping definition has unsupported parameters: [crm-nonprod-metrics : {filter={terms={tags=[pre, sit]}}}] [crm-prod-metrics : {filter={term={tags=crm}}}]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [aliases]: Root mapping definition has unsupported parameters: [crm-nonprod-metrics : {filter={terms={tags=[pre, sit]}}}] [crm-prod-metrics : {filter={term={tags=crm}}}]",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "Root mapping definition has unsupported parameters: [crm-nonprod-metrics : {filter={terms={tags=[pre, sit]}}}] [crm-prod-metrics : {filter={term={tags=crm}}}]"
    }
  },
  "status": 400
}
```

This is what im trying to do:

```auto

PUT _template/crm-metricbeat-6
{
  "order": 1,
  "index_patterns": [
    "crm-metricbeat-*"
  ],
  "settings": {
    "index": {
      "routing": {
        "allocation": {
          "require": {
            "type": "metric"
          }
        }
      },
      "mapping": {
        "total_fields": {
          "limit": "10000"
        }
      },
      "refresh_interval": "5s",
      "number_of_routing_shards": "30",
      "number_of_shards": "5",
      "query": {
        "default_field": [
          "beat.hostname"
        ]
      }
    }
  },
  "mappings": {
    "doc": {
...
    },
    "aliases": {
      "crm-nonprod-metrics" : {
        "filter" : {
          "terms" : {
            "tags" : [
              "pre",
              "sit"
            ]
          }
        }
      },
      "crm-prod-metrics": {
        "filter": {
          "term": {
            "tags": "crm"
            
          }
        }
      }
    }
  }
}
```

I think it should work, my command looks similar to the example from the docs:  
[https://www.elastic.co/guide/en/elasticsearch/reference/6.8/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/indices-templates.html)

```auto

PUT _template/template_1
{
    "index_patterns" : ["te*"],
    "settings" : {
        "number_of_shards" : 1
    },
    "aliases" : {
        "alias1" : {},
        "alias2" : {
            "filter" : {
                "term" : {"user" : "kimchy" }
            },
            "routing" : "kimchy"
        },
        "{index}-alias" : {} 
    }
}
```

Can you see any error in my command?

---

<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:** [May 6, 2020, 4:01pm UTC](https://discuss.elastic.co/t/index-template-adding-multiple-aliases/227171/2 "2020-05-06T16:01:09Z")

</div>

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