Index template - adding multiple aliases

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

{
  "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:


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


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?

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