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

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 documentation and they did not mention if I could force an update on my indices. Hence, the question.

1 Like

After reading up on the Rollover Index API 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! :slight_smile:

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,

via this post

2 Likes

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