# ElasticCloud rollover

**URL:** https://discuss.elastic.co/t/elasticcloud-rollover/271939
**Category:** Kibana
**Tags:** ilm-index-lifecycle-management
**Created:** [May 3, 2021, 7:18am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939 "2021-05-03T07:18:50Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![mfa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mfa/32/87041_2.png) [@mfa](https://discuss.elastic.co/u/mfa)
#### Post date: [May 3, 2021, 7:18am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/1 "2021-05-03T07:18:50Z")

</div>

I have sat up lifecycle policy for index in order to delete the index if it gets over 50 gb. The index is called: myindex-000001 and when the policy applies, it creates the second index which calls it: myindex-000002 automatically.  
The application (node js) is pointing to the first index as it is not aware og the new index therefor it doesn't send data to the new created index and as a result it gives error on the first index that shards failed.  
I'm wondering how this can be fixed?  
Should the application send data to alias of index? or can it be send to myindex-\* so that in case of rollover and getting new number it still can send data?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [May 3, 2021, 7:24am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/2 "2021-05-03T07:24:39Z")

</div>

> [@mfa](#):
>
> Should the application send data to alias of index?

Ye, you should be using the write alias for the policy as you defined it.

---

<div class="post-metadata">

### Author: ![mfa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mfa/32/87041_2.png) [@mfa](https://discuss.elastic.co/u/mfa)
#### Post date: [May 3, 2021, 7:29am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/3 "2021-05-03T07:29:22Z")

</div>

> [@warkolm](#):
>
> write alias for the policy

can you give me an example please?

This is my policy:

```auto
    PUT _ilm/policy/deleting_policy
    {
      "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_size": "50gb"
          },
          "set_priority": {
            "priority": 100
          }
        }
      },
      "delete": {
        "min_age": "25d",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }
        }
      }
     }
     }
    }

```

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [May 3, 2021, 7:30am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/4 "2021-05-03T07:30:39Z")

</div>

What does the template that you setup look like?

You need to look for `index.lifecycle.rollover_alias` as per [Rollover | Elasticsearch Guide [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.12/ilm-rollover.html)

---

<div class="post-metadata">

### Author: ![mfa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mfa/32/87041_2.png) [@mfa](https://discuss.elastic.co/u/mfa)
#### Post date: [May 3, 2021, 7:38am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/5 "2021-05-03T07:38:57Z")

</div>

Here is my template:

```auto
PUT _component_template/template1
{
  "template": {
    "mappings": {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "ttlInDays": {
          "type": "integer"
        },
        "@log_group": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "@message": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "@owner": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "versionId": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "awsRegion": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "ip": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "sensitiveData": {
          "type": "text"
        },
        "correlationId": {
          "type": "text"
        },
        "serviceId": {
          "type": "text"
        }
      }
    }
  }
}

PUT _index_template/template_1
{
  "index_patterns": ["myindex*", "index2*", "index3*"],
  "template": {
    "settings": {
      "number_of_shards": 1,
      "index.lifecycle.name": "deleting_policy"
    }
  },
  "priority": 200,
  "composed_of": ["template1"],
  "version": 3,
  "_meta": {
    "description": "Prod Template"
  }
}

```

I have several indexes that each of them has it's own alias name. How can I add index.lifecycle.rollover\_alias in template properly to assign the alias name for each index?

What about the node-js app that points to the first index -00001, not the rollover one ?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [May 3, 2021, 7:43am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/6 "2021-05-03T07:43:06Z")

</div>

> [@mfa](#):
>
> I have several indexes that each of them has it's own alias name. How can I add index.lifecycle.rollover\_alias in template properly to assign the alias name for each index?

The docs go into this, so it's best to start there and let us know if you have issues.

> [@mfa](#):
>
> What about the node-js app that points to the first index -00001, not the rollover one ?

You need to update it to use the alias.

---

<div class="post-metadata">

### Author: ![mfa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mfa/32/87041_2.png) [@mfa](https://discuss.elastic.co/u/mfa)
#### Post date: [May 3, 2021, 7:53am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/7 "2021-05-03T07:53:29Z")

</div>

> [@mfa](#):
>
> index.lifecycle.rollover\_alias

can you please send me the link to the doc? I have searched a while for this issue but couldn't find a solution to set the index.lifecycle.rollover\_alias properly in the template therefor, every time I have to add it manually after index creation.  
Someone also mentioned it here in 2019 but it hasn't been fixed or given any solution for that:

> <https://github.com/elastic/elasticsearch/issues/38454>
>
> Similar (but simpler than) #36627, one should be able to use \`{index}\` placehold…er while specifying a \`index.lifecycle.rollover\_alias\`.

This is really a big issue and needs a solution for it.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [May 3, 2021, 7:56am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/8 "2021-05-03T07:56:16Z")

</div>

That issue is not related to what you are doing as far as I can see.

The link is in my first post, but - [Rollover | Elasticsearch Guide [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.12/ilm-rollover.html)

---

<div class="post-metadata">

### Author: ![mfa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mfa/32/87041_2.png) [@mfa](https://discuss.elastic.co/u/mfa)
#### Post date: [May 3, 2021, 8:07am UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/9 "2021-05-03T08:07:17Z")

</div>

This is actually completely related. Maybe I haven't express it clearly in my first post, sorry for that.  
But today I add index.lifecycle.rollover\_alias manually after I check and see that a new index has been created using template, and while I don't check it, the error stays there and the teams get problem until someone fix it manually.  
If I would be able to add this under the template then it would be created automatically in index creation time.

```auto
settings": {
    "index.lifecycle.name": "my_policy",      
    "index.lifecycle.rollover_alias": "{write_index}-alias"    
  }

```

At the moment the only solution is to create separated template for each index which doesn't seem nice. If someone has over 10 indexes it needs over 10 templates...  
Is this issue, that mentioned in that post, under development?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [May 12, 2021, 11:36pm UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/10 "2021-05-12T23:36:56Z")

</div>

It doesn't look like that's being worked on, as it's been pushed into datastreams functionality.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 9, 2021, 11:37pm UTC](https://discuss.elastic.co/t/elasticcloud-rollover/271939/11 "2021-06-09T23:37:27Z")

</div>

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