Is there any way to create aliases for new (Future) index also in elasticsearch?

Hello,

We can able to create aliases and filters for the existing indexes without any issues.

However we are not able to create aliases for the new indexes.

Is there any way to create aliases for new (Future) index also in elasticsearch?

Thanks,
Thiru.

You cannot add an index that doesn't exist to an alias.

You can setup a template that contains an alias though, that would work.

Hi Warkolm,

I have created the template with alias and it's working fine and alias created.

However, when trying alias filter with the template getting below error
"failed action with response of 400, dropping action:"

Anything wrong with this template?

Template :
curl -XPUT 'http://localhost:9200/_template/template_cpu' -d ' {
"template":"logstash-tools-alias-test-*", "order": 1,"settings":{"index.number_of_replicas":"1"},
"aliases" : { "alias-system-cpu" : {"filter" : { "term" : {"host.raw" : "xxx.xxx" } }, "routing" : "xxx.xxx"} }}'

Thanks,
Thiru.

Hello Warkolm,

Did you get a chance to very this Template query which will have alias with filter in it?

Template :
curl -XPUT 'http://localhost:9200/_template/template_cpu' -d ' {
"template":"logstash-tools-alias-test-*", "order": 1,"settings":{"index.number_of_replicas":"1"},
"aliases" : { "alias-system-cpu" : {"filter" : { "term" : {"host.raw" : "xxx.xxx" } }, "routing" : "xxx.xxx"} }}'

is there anything wrong on this template?

Thanks,
Thiru.