New Index is not getting Updated in Alias

Hi Experts,

I created Index Pattern as xyz-* and created alias for this index pattern as abc using following command

POST /_aliases
  "actions" : [
    { "add" : { "index" : "xyz-*", "alias" : "abc" } }

If new index is getting add in xyz-* pattern, lets say xyz-100
its not getting updated in abc alias,

Is there any command for this
Please Help.

Thank you
Regards RK

Believe the _alias API is a 1 time deal and applies to indexes that are currently in Elastic.

If you want it to apply to new ones then an index template is the way to go.

Below says any index that is created that falls within the index pattern to apply the alias.

PUT _index_template/name_it_here
  "index_patterns": ["xyz-*"],
  "template": {
    "aliases": {
      "alias_name": { }
1 Like

Just confirming what I wrote above.

In this case, the alias is a point-in-time alias that will group all current indices that match, it will not automatically update as new indices that match this pattern are added/removed.