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

**URL:** <https://discuss.elastic.co/t/how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/353416>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [February 15, 2024, 9:43pm UTC](https://discuss.elastic.co/t/how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/353416 "2024-02-15T21:43:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![idan\_amar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/idan_amar/32/131806_2.png) [@idan\_amar](https://discuss.elastic.co/u/idan_amar)\
**Post date:** [February 15, 2024, 9:43pm UTC](https://discuss.elastic.co/t/how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/353416/1 "2024-02-15T21:43:09Z")

</div>

Is it possible to force a rollover for my indices to the latest updated policy? So they would be in the correct phase?

```auto
GET _ilm/policy/netlogstash_policy

{
  "netlogstash_policy": {
    "version": 1,
    "modified_date": "2024-02-15T21:10:11.004Z",
    "policy": {
      "phases": {
        "warm": {
          "min_age": "7d",
          "actions": {
            "set_priority": {
              "priority": 50
            }
          }
        },
        "cold": {
          "min_age": "14d",
          "actions": {
            "set_priority": {
              "priority": 0
            }
          }
        },
        "hot": {
          "min_age": "0ms",
          "actions": {
            "set_priority": {
              "priority": 100
            },
            "rollover": {
              "max_age": "30d",
              "max_primary_shard_size": "50gb"
            }
          }
        },
        "delete": {
          "min_age": "30d",
          "actions": {
            "delete": {
              "delete_searchable_snapshot": true
            }
          }
        }
      }
    },
    "in_use_by": {
      "indices": [
        "netlogstash-2024.01.29"
      ],
      "data_streams": [],
      "composable_templates": [
        "netlogstash_template"
      ]
    }
  }
}

```

the indice

```auto
GET netlogstash-2024.01.29/_ilm/explain

{
  "indices": {
    "netlogstash-2024.01.29": {
      "index": "netlogstash-2024.01.29",
      "managed": true,
      "policy": "netlogstash_policy",
      "index_creation_date_millis": 1706536822224,
      "time_since_index_creation": "17.31d",
      "lifecycle_date_millis": 1708032747445,
      "age": "6.94m",
      "phase": "hot",
      "phase_time_millis": 1708032371263,
      "action": "complete",
      "action_time_millis": 1708032747446,
      "step": "complete",
      "step_time_millis": 1708032747446,
      "phase_execution": {
        "policy": "netlogstash_policy",
        "phase_definition": {
          "min_age": "0ms",
          "actions": {
            "set_priority": {
              "priority": 100
            },
            "rollover": {
              "max_age": "30d",
              "max_primary_shard_size": "50gb"
            }
          }
        },
        "version": 1,
        "modified_date_in_millis": 1708031411004
      }
    }
  }
}

```

im sorry, im new to elastic. Does doing a rollover to an index means to update it to the current phase per the configured ILM? In this example it should be at the "cold" phase.

Thank you!

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 19, 2024, 12:31am UTC](https://discuss.elastic.co/t/how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/353416/2 "2024-02-19T00:31:49Z")

</div>

HI @idan_amar Welcome to the community.

Looks to me the index is about 17days old

> [@idan\_amar](#):
>
> ` "time_since_index_creation": "17.31d",`

BUT the index has not rolled over... Because as defined I'm your policy it needs to be 30dayd or 50GB

> [@idan\_amar](#):
>
> ```auto
> "hot": {
> "min_age": "0ms",
> "actions": {
> "set_priority": {
> "priority": 100
> },
> "rollover": {
> "max_age": "30d", <--- HERE 
> "max_primary_shard_size": "50gb"
> }
> }
> },
> 
> ```

All subsequent phases are calculated from rollover... Not creation... Common confusion...

The clock does not start for warm / cold etc until rollover.

> **[Rollover | Elasticsearch Guide \[8.12\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-rollover.html#_rollover_condition_blocks_phase_transition)**

You can manually rollover the index or set the rollover to a smaller time range . The current index even if you change the policy will be picked up when you rollover..

---

<div class="post-metadata">

**Author:** ![idan\_amar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/idan_amar/32/131806_2.png) [@idan\_amar](https://discuss.elastic.co/u/idan_amar)\
**Post date:** [February 20, 2024, 4:19pm UTC](https://discuss.elastic.co/t/how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/353416/3 "2024-02-20T16:19:18Z")

</div>

im sorry for the ignorance but what does "rollover" actually do?

Do i need to do this action to any index i apply to a ILM policy?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 20, 2024, 7:20pm UTC](https://discuss.elastic.co/t/how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/353416/4 "2024-02-20T19:20:32Z")

</div>

> [@idan\_amar](#):
>
> im sorry for the ignorance but what does "rollover" actually do?

Remove the index as the write index for the rollover alias and start indexing to a new index.  
Rolls over a target to a new index when the existing index satisfies the specified rollover conditions.

But looks like you are writing Daily Indices so no, you probably do not need rollover... even though it would probably be better in the long run.

> [@idan\_amar](#):
>
> Do i need to do this action to any index i apply to a ILM policy?

No, it is one method to optimize ILM.

You look to be using daily indices so you do not need rollover... you can / should take it out... but I am not sure if that will help the existing index.

You may be in a strange state...

So take it (the rollover section) out of the ILM policy...

I think you will also need to set this...

> **[Skip rollover | Elasticsearch Guide \[8.12\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/skipping-rollover.html)**

wait ten minutes and then run the ILM explain again...

Also run this and show the settings section need to see if there is an write  
`GET netlogstash-2024.01.29`

Lets see what happens

Unfortunately it does not look like you set this up correctly in the first place..

I highly recommends reading the documentation...

---

<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:** [March 19, 2024, 7:21pm UTC](https://discuss.elastic.co/t/how-can-i-do-a-manual-rollover-for-all-indices-to-the-newest-index-policy/353416/5 "2024-03-19T19:21:31Z")

</div>

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