Every 30 seconds, the system status will be stored in the ES. The index name is, for example, i_index-2019-10-10. The aggregation will be done every 5 minutes. The data of this table will be summarized into the 5-minute table. The index name is for example: i_index- 5m-2019-10-10, I want to use a template definition, i_index-20* corresponds to the alias a_index, and i_index-5m-* corresponds to the alias a_index-5m.
How should the template file be written?
Elasticsearch version :7.3.1
1.I tried to write like this, it doesn't work
PUT _template/t_ceshi
{
"order": 0,
"index_patterns": ["i_ceshi-*"],
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas": "0",
"refresh_interval": "5s"
}
},
"mappings": {
"dynamic": false,
"properties": {
}
},
"aliases": {
"actions" : [
{ "add" : { "index" : "i_ceshi-20*", "alias" : "a_ceshi" } },
{ "add" : { "index" : "i_ceshi-5m-*", "alias" : "a_ceshi-5m" } }
]
}
}
2.I also tried to write like this, it doesn’t work either.
PUT _template/t_ceshi
{
"order": 0,
"index_patterns": ["i_ceshi-*"],
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas": "0",
"refresh_interval": "5s"
}
},
"mappings": {
"dynamic": false,
"properties": {
}
},
"aliases": {
"a_ceshi": {"index":"i_ceshi-20*"},
"a_ceshi-5m": {"index":"i_ceshi-5m-*"}
}
}