Create and apply policy

  1. In Kibana dashboard, navigate to Index Management tab from the burger menu.

im

  1. Navigate to Index Plocies and click on Create Policy.

policy

  1. Update Policy Id field as hot_to_warm
  2. Under Define Policy, replace the default policy with the below mentioned policy. Then click Create
{
    "policy": {
        "policy_id": "hot_to_warm",
        "description": "Demonstrate a hot-warm workflow.",
        "default_state": "hot",
        "states": [
            {
                "name": "hot",
                "actions": [],
                "transitions": [
                    {
                        "state_name": "warm",
                        "conditions": {
                            "min_index_age": "1d"
                        }
                    }
                ]
            },
            {
                "name": "warm",
                "actions": [
                    {
                        "timeout": "24h",
                        "retry": {
                            "count": 5,
                            "backoff": "exponential",
                            "delay": "1h"
                        },
                        "warm_migration": {}
                    }
                ],
                "transitions": []
            }
        ]
    }
}

The above policy has two states named as hot and warm. The default state is hot. As per the policy, you can see that hot state is transitioning to warm state when the condition is met. The condition is set as index age of 1 day. After 1 day of index creation, it will move to warm state where the action of warm_migration is mentioned. Once the index is in warm there are no transitions defined.

code

  1. Once the policy creation is complete, you should see a screen as below.

created

  1. The next step is to apply the policy that we created to an index. For that, please navigate to Indices tab and select the kibana_sample_data_logs index. After selecting the index, click on Apply Policy.

apply

  1. In the pop-up window, select the policy name from the dropdown and click Apply.

dropdown

confirm

  1. After applying the policy to the index, Navigate to Managed Indices. You should see that the job status is Initializing.

initialize

After you attach a policy to an index, ISM creates a job that runs every 30 to 48 minutes to perform policy actions, check conditions, and transition the index into different states. Once a policy is applied, the job status may take 30 - 48 minutes to change it’s status. After that timeframe you should see the job status as ‘Running’. You will have to keep the domain up and running for the next 24 hours to see the ISM in action.

running

The policy will be executed on the index only after 24 hrs of index creation time. For the migration to happen, the domain need to up and running for that much time.

  1. Once the condition mentioned in the policy is met (1 day after index creation), the index will automatically get migrated to warm state. You sould be able to validate the same by navigating to Managed Indices and verifying the State,Action and Info fields.

migrated

Congragulations! You have automated the ultrawarm migration of your index using index state management.