Add a method to compute alias names for index templates


(Learnning Golang) #1

I want to implement automatic mapping of aliases when created by index。 Use the following link。


This is my profile.
{
"order": 5,
"version": 60001,
"index_patterns": [
"debug*"
],
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas": "0",
"refresh_interval": "1s"
}
},
"mappings": {
"doc": {
"properties": {
"logLevel": {
"type": "keyword"
},
"hostname": {
"type": "keyword"
},
"application": {
"type": "keyword"
}
}
}
},
"aliases": {
"{application}-alias-for-{env}": {
"format": {
"env": {
"lang": "expression",
"script": "doc['logLevel'].value"
},
"application": {
"lang": "expression",
"script": "doc['application'].value"
}
}
}
}
}

But, result is

GET /_aliases
"debug-2018": {
"aliases": {
"application": {},
"{application}-alias-{env}": {}
}
},