Dynamic alias remapping for newly created index

When I create the following alias, it maps currently available indexes like apps-2019.09.11, apps-2019.09.12

curl -XPOST  'localhost:9200/_aliases' -H 'Content-Type: application/json' -d'
    "actions" : [
        { "add" : { "index" : "apps*", "alias" : "backend_apps" } }

-XGET "http://localhost:9200/_cat/aliases"
java_apps        apps-2019.09.11            - - -
java_apps        apps-2019.09.12            - - -

When the new index gets created e.g. apps-2019.09.13, the alias doesn't map to it automatically.
So, if I run the above POST query the second time, it solves the problem.

Question: is there any option to make alias gets mapped automatically to newly created indexes based on pattern apps*

I obviously could do this via script/cron/daemonset, but wondering if there is a native option.

Thank you in advance!

Add the alias to your index template and it will be added when the index is created.

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