Its been a while but yesterday I created a new index template as you showed. However , nothing changed and fields that I have set stayed unmapped. There are two index templates for alert indices, the default one and custom one that I created:
Default template:
{
"order": 10,
"index_patterns": [
"alert-*",
"alert_status",
"alert_error",
"alert_silence"
],
"settings": {
"index": {
"refresh_interval": "1s",
"number_of_shards": "1",
"auto_expand_replicas": "1-2",
"number_of_replicas": "0"
}
},
"mappings": {
"properties": {
"aggregate_id": {
"type": "keyword"
},
"alert_time": {
"format": "dateOptionalTime",
"type": "date"
},
"@timestamp": {
"format": "dateOptionalTime",
"type": "date"
},
"data": {
"type": "object",
"enabled": "false"
},
"rule_name": {
"type": "keyword"
},
"alert_id": {
"type": "keyword"
},
"match_body": {
"type": "object",
"enabled": "false"
},
"match_time": {
"format": "dateOptionalTime",
"type": "date"
},
"until": {
"format": "dateOptionalTime",
"type": "date"
}
}
},
"aliases": {}
}
The custom one:
{
"order": 90,
"index_patterns": [
"alert"
],
"settings": {},
"mappings": {
"properties": {
"match_body._index": {
"type": "object",
"enabled": "true"
},
"match_body.agent.lables.tenant": {
"type": "object",
"enabled": "true"
}
}
},
"aliases": {}
}
Maybe changes did not apply because of order priority? Additional question is, should I really set those fields (_index, agent.lables.tenant) as object types, not strings? I tried to set them as type "string", but the service throwed an error.