# Ism rollover for multiple aliases and for alias filter

**URL:** <https://forum.opensearch.org/t/ism-rollover-for-multiple-aliases-and-for-alias-filter/10856>\
**Category:** Index Management\
**Created:** [September 7, 2022, 3:26pm UTC](https://forum.opensearch.org/t/ism-rollover-for-multiple-aliases-and-for-alias-filter/10856 "2022-09-07T15:26:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![orid](https://avatars.discourse-cdn.com/v4/letter/o/6f9a4e/32.png) [@orid](https://forum.opensearch.org/u/orid)\
**Post date:** [September 7, 2022, 3:26pm UTC](https://forum.opensearch.org/t/ism-rollover-for-multiple-aliases-and-for-alias-filter/10856/1 "2022-09-07T15:26:34Z")

</div>

Hi,

1. Can I rollover multiple aliases of the same index ?

2. It looks like the rollover doesn’t take alias filter into account.  
For example, I create the following index with alias for rollover :

Thank you.

---

<div class="post-metadata">

**Author:** ![orid](https://avatars.discourse-cdn.com/v4/letter/o/6f9a4e/32.png) [@orid](https://forum.opensearch.org/u/orid)\
**Post date:** [September 15, 2022, 8:57am UTC](https://forum.opensearch.org/t/ism-rollover-for-multiple-aliases-and-for-alias-filter/10856/2 "2022-09-15T08:57:21Z")

</div>

I have created github issues.  
For item (1):

> <https://github.com/opensearch-project/OpenSearch/issues/4524>
>
> \*\*Is your feature request related to a problem? Please describe.\*\*
> When I perfo…rm an index rollover (weather directly by the rollover API or by using the ISM job), I want \*\*all\*\* aliases of an index to be rolled over.
> I have an index with multiple aliases (my-alias-01, my-alias-02,…), and I want all of them to be rollover.
> 
> 
> \*\*Describe the solution you'd like\*\*
> 
> Let's assume I have an index with 2 aliases.
> 
> \`\`\`
> PUT my-index-000001
> {
> "aliases": {
> "my-alias-01": {
> "is\_write\_index": true
> },
> "my-alias-02": {
> "is\_write\_index": true
> }
> }
> }
> 
> \`\`\`
> I want to do something like that in my index template:
> \`\`\`
> "plugins.index\_state\_management.rollover\_alias": "my-alias\*"
> \`\`\`\`
> Then, when rollover action occurs, a new index 'my-index-000002' will be created with both aliases.
> 
> Or, when running rollover API directly:
> \`\`\`POST my-alias\*/\_rollover\`\`\`
> the rollover will create a new index \`my-index-000002\` with all the matched aliases.
> Right now, it fails with:
> \`\`\`
> {
> "error" : {
> "root\_cause" : \[
> {
> "type" : "illegal\_argument\_exception",
> "reason" : "rollover target \[my-alias-\*\] does not exist"
> }
> \],
> "type" : "illegal\_argument\_exception",
> "reason" : "rollover target \[my-alias-\*\] does not exist"
> },
> "status" : 400
> }
> \`\`\`
> 
> \*\*Describe alternatives you've considered\*\*
> I could not find any alternative.
> Right now, I have my own code that performs alias creation on the new index after rollover.

For item (2):

> <https://github.com/opensearch-project/index-management/issues/496>
>
> \*\*What is the bug?\*\*
> Create an index rollover policy and associate to index (wi…th index template).
> When creating the first index, the index contains an alias for rollover. This alias also contains a filter.
> After rollover, additional index is created, but the new index with the alias. But the filter is missing in the alias of the new index.
> Moreover, the alias filter in the original index (before rollover) is also deleted. 
> 
> \*\*How can one reproduce the bug?\*\*
> Steps to reproduce the behavior:
> 1. Create ISM policy
> \`\`\`
> PUT \_plugins/\_ism/policies/rollovertests\_policy
> {
> "policy": {
> "description": "test rollover policy.",
> "default\_state": "rollover",
> "states": \[
> {
> "name": "rollover",
> "actions": \[
> {
> "rollover": {
> "min\_index\_age": "2m"
> }
> }
> \],
> "transitions": \[\]
> }
> \] 
> ,
> "ism\_template": {
> "index\_patterns": \["rollovertests\*"\],
> "priority": 100
> }
> }
> }
> 
> \`\`\`
> 3. Create index template with relation to policy and rollover\_alias. 
> \`\`\`
> PUT \_index\_template/rollovertests\_template
> {
> "index\_patterns": \[
> "rollovertests-\*"
> \],
> "template": {
> "settings": {
> "number\_of\_shards": 1,
> "number\_of\_replicas": 1,
> "plugins.index\_state\_management.rollover\_alias": "rollovertests"
> },
> "mappings": {
> "\_routing": {
> "required": true
> },
> "properties": {
> "timestamp": {
> "type": "date",
> "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch\_millis"
> }
> }
> }
> }
> }
> 
> \`\`\`
> 5. Create a new index with alias and filter
> \`\`\`
> PUT rollovertests-000001
> {
> "aliases": {
> "rollovertests": {
> "is\_write\_index": true,
> "filter": {
> "term": {
> "timestamp": "1574641891142"
> }
> }
> }
> }
> }
> \`\`\`
> 7. Make sure index was created properly with the alias
> \`\`\`
> GET rollovertests-\*/\_alias
> 
> {
> "rollovertests-000001" : {
> "aliases" : {
> "rollovertests" : {
> "filter" : {
> "term" : {
> "timestamp" : "1574641891142"
> }
> },
> "is\_write\_index" : true
> }
> }
> }
> }
> 
> \`\`\` 
> 7. Wait few minutes for rollover action.
> 9. Query the newly generated index and the original index. You can see that filter is missing in both.
> \`\`\`
> GET rollovertests-\*/\_alias
> 
> 
> {
> "rollovertests-000002" : {
> "aliases" : {
> "rollovertests" : {
> "is\_write\_index" : true
> }
> }
> },
> "rollovertests-000001" : {
> "aliases" : {
> "rollovertests" : {
> "is\_write\_index" : false
> }
> }
> }
> }
> 
> \`\`\`
> 
> 
> \*\*What is the expected behavior?\*\*
> Alias filter should be copied to new index after rollover.
> Alias filter should not be deleted from original alias and index.
> 
> \*\*What is your host/environment?\*\*
> - OS: AWS OpenSearch 
> - Version : 1.3.2
> - Plugins
