Elasticsearch _aliases usage in Templates?

Hi

   POST /_aliases
    {
        "actions" : [
            { "add" : { "index" : "test*", "alias" : "all_test" } }
        ]
    }

1)Based on the above configuration all the indices that start with test and also that are present in the cluster at that point of time will be kept in all_test alias.

2)If i create alias in Template by using below configuration

PUT localhost:9200/_template/test -d '
{
  "template" : "test*",
  "aliases" : {
    "all_test" : {}
  } 
}

This will send the future indices which starts with test* to all_test alias.

Can i able to do 1+2 = I want to send the existing indices and the future indices to particular alias which i will define in ES Template?

Thanks

Yes, you can do 1+2 to send the existing indices and the future indices to a particular alias which i will define in ES Template.

Thanks
Can you pls provide a sample code for the use case that i had mentioned above?
So, that i will know how to do that?

I just use the API call you provided in 1) and 2) . Not sure what sample code you are expecting.

Thanks ..

That means you are executing 1+2 using api's .

But what i want is can you send the existing indices and future indices to one alias that we define in template?

Through some study i found it out that cant be possible in a template. I have to follow the above 1 and 2 steps.

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