Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): 2.19
Describe the issue: Can’t name an index with the dynamic part of an index name template pattern
In my company we use opensearch for multiple types of documents in different indexes for multiple clients. So we have templates for each kind of document and an alias for the client, using the client id on the name i.e for the client_id 8 we would have the indexes: files-8, records-8… and the alias: client-8 assigned to files-8, records-8….
We have templates for each kind of document with pattern: files-*, records-*… But there is no way to assign the alias on the template as I would need to capture the dynamic part to assign the newly created, that could be done with a syntax like that maybe
"template": {
"aliases": {
"client-$1": {}
}
}
so we could assign the newly created index to the client alias, but we could not find an option to assign it to the regex segment captured on the index pattern.
This forces us to manually assign the alias for each index to each client. Or, as the indexes are automatically created based on the template, check on each index operation if the alias is assigned and assign it otherwise, which is not ideal.
Is there a way to automatically create and assign the alias based on the dynamic part of index template pattern?