Index alias with wildcard?

Hello,
I am creating a daily index. Indices look like the following
my-index-2020-08-31
my-index-2020-08-30
my-index-2020-08-29
my-index-yyyy-mm-dd

Is t possible to add to the template an index alias with wildcard?
I want, for example, change the order of the naming.
my-index-2020-08-31 --> index-my-2020-08-31
my-index-2020-08-30 --> index-my-2020-08-30
my-index-yyyy-mm-dd --> index-my-yyyy-mm-dd

Something like

PUT _template/my-index-template
{
    "index_patterns" : [
      "my-index-*"
    ],
    "settings" : {
      "index" : {
        "lifecycle" : {
          "name" : "ilm-1"
        },
        "number_of_shards" : "1",
        "number_of_replicas" : "1"
      }
    },
    "mappings" : {
      "_source" : {
        "enabled" : true
      },
      "properties" : {}
    },
    "aliases" : { 
	"index-my*" {}
	}
}	

Or how can I manage this?

Thanks!

You can't do that mapping with a template, no.

Is there a reason you can't just rename the index?

All visualisations (and other objects) are based on the original name. I'll have to update all visualisations. dashboards, ml-jobs, etc. to be based on the new naming convention.
It's a lot of work... trying to find shortcuts, or workarounds.

Ah ok, fair point.

You could export all your Kibana assets and then open the export.json in a text editor and do a find and replace?

I can try that.
But from past experience, it will lead to multiple issues in the future.
This is not a bullet proof solution.

Yeah it's not sorry to say.

I would suggest creating an issue on the Kibana GitHub repo to highlight this.

1 Like