Elasticsearch Engineer Lab 7.3: Index lifecycle management query

Course: Elasticsearch Engineer Lab 7.3: Index lifecycle management
Version: 8.1
Question: Query regarding rollover duration

Below is the lab question:

  • the index is in the hot phase for 2 minutes
  • when the index rolls over, it immediately moves to the warm phase, and the number of replicas is set to 1
  • after 2 minutes in the warm phase, the index moves to the cold phase and the number of replicas is set to 0
  • 5 minutes after rolling over, the index is deleted

Solution provided:

PUT _ilm/policy/my-metrics-policy
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_age": "2m"
          },
          "set_priority": {
            "priority": 100
          }
        },
        "min_age": "0ms"
      },
      "warm": {
        "min_age": "0d",
        "actions": {
          "set_priority": {
            "priority": 50
          },
          "allocate": {
            "number_of_replicas": 1
          }
        }
      },
      "cold": {
        "min_age": "2m",
        "actions": {
          "set_priority": {
            "priority": 0
          },
          "allocate": {
            "number_of_replicas": 0
          }
        }
      },
      "delete": {
        "min_age": "5m",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

I assume the solution to work as below:

  • the index is in the hot phase for 2 minutes
  • when the index rolls over, it immediately moves to the warm phase, and the number of replicas is set to 1
  • after "0" minutes in the warm phase or 2 mins from rollover, the index moves to the cold phase and the number of replicas is set to 0
  • 5 minutes after rolling over, the index is deleted

For index to be in warm phase for 2 mins and then rollover, I assume min_age should be 4m in cold phase.

      "cold": {
        "min_age": "4m",
        "actions": {
          "set_priority": {
            "priority": 0
          }

Correct me if I am wrong. :slight_smile:

Thanks,
Bryce

Apologies, cleared the confusion between rollover time and moving to phase time.
Solution provided in the lab is correct.

Regards,
Bryce

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