# \[Solved\] How can i do a manual rollover for all indices to the newest index policy?

**URL:** <https://discuss.elastic.co/t/solved-how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/184694>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [June 7, 2019, 6:20am UTC](https://discuss.elastic.co/t/solved-how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/184694 "2019-06-07T06:20:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TsuWeiQuan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsuweiquan/32/46252_2.png) [@TsuWeiQuan](https://discuss.elastic.co/u/TsuWeiQuan)\
**Post date:** [June 7, 2019, 6:20am UTC](https://discuss.elastic.co/t/solved-how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/184694/1 "2019-06-07T06:20:52Z")

</div>

Is it possible to force a rollover for my indices to the latest updated policy?

Currently, I have 3 indices in 1 policy and I have just updated my policy. It is now version 61.

```
GET _ilm/policy/filebeat-7.0.1
{
  "filebeat-7.0.1" : {
    "version" : 61,
    "modified_date" : "2019-06-07T06:14:08.982Z",
    "policy" : {
      "phases" : {
        "hot" : {
          "min_age" : "1d",
          "actions" : {
            "rollover" : {
              "max_size" : "1gb",
              "max_age" : "1d"
            }
          }
        },
        "delete" : {
          "min_age" : "30d",
          "actions" : {
            "delete" : { }
          }
        }
      }
    }
  }
}

```

and this is one of the indices in this policy.

```
GET filebeat-esnode1-2019.05.29-000001/_ilm/explain
{
  "indices" : {
    "filebeat-esnode1-2019.05.29-000001" : {
      "index" : "filebeat-esnode1-2019.05.29-000001",
      "managed" : true,
      "policy" : "filebeat-7.0.1",
      "lifecycle_date_millis" : 1559120066378,
      "phase" : "hot",
      "phase_time_millis" : 1559120066554,
      "action" : "rollover",
      "action_time_millis" : 1559120507394,
      "step" : "check-rollover-ready",
      "step_time_millis" : 1559120507394,
      "phase_execution" : {
        "policy" : "filebeat-7.0.1",
        "phase_definition" : {
          "min_age" : "0ms",
          "actions" : {
            "rollover" : {
              "max_size" : "50gb",
              "max_age" : "30d"
            }
          }
        },
        "version" : 34,
        "modified_date_in_millis" : 1559120065826
      }
    }
  }
}

```

I have been reading [this](https://www.elastic.co/guide/en/elasticsearch/reference/7.1/_updates_to_executing_policies.html) documentation and they did not mention if I could force an update on my indices. Hence, the question.

---

<div class="post-metadata">

**Author:** ![TsuWeiQuan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsuweiquan/32/46252_2.png) [@TsuWeiQuan](https://discuss.elastic.co/u/TsuWeiQuan)\
**Post date:** [June 7, 2019, 6:42am UTC](https://discuss.elastic.co/t/solved-how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/184694/2 "2019-06-07T06:42:46Z")

</div>

After reading up on the [Rollover Index API](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html) portion of the documentation, i found my answer!

Apparently i just have to run

```
POST /filebeat-esnode1/_rollover 
{
  "conditions": {
    "max_age": "1d",
    "max_size": "1gb"
  }
}

```

where `filebeat-esnode1` is the rollover alias of the index.  
I now see new index being created.

Running this process for all indices that belong to the policy will upgrade all indices version.

Using `GET filebeat-esnode1/_ilm/explain` & `GET _ilm/policy/filebeat-7.0.1` in the console allows me to cross check! 🙂

Edit--  
However, doing a manual rollover will cause lifecycle error as shown :

```
Index lifecycle error
illegal_argument_exception: index [filebeat-esnode1] is not the write index for alias [filebeat-esnode1-2019.05.29-000001]

```

To solve this,

> [@Index management error: "Index is not the write index for alias"](https://discuss.elastic.co/t/index-management-error-index-is-not-the-write-index-for-alias/180894/3):
>
> you can set `index.lifecycle.indexing_complete` to `true` and use the [Retry API](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/ilm-retry-policy.html) to allow ILM to skip rollover in this case.

via [this post](https://discuss.elastic.co/t/index-management-error-index-is-not-the-write-index-for-alias/180894/2)

---

<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:** [July 5, 2019, 6:42am UTC](https://discuss.elastic.co/t/solved-how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/184694/3 "2019-07-05T06:42:49Z")

</div>

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