ILM policy not working

index-lifecycle-management
(Indrek ) #1

Hello

I created ilm policy /_ilm/policy/datastream_policy

{
  "policy": {                       
    "phases": {
      "hot": {                      
        "actions": {
          "rollover": {             
            "max_size": "1MB",
            "max_age": "1m"
          }
        }
      },
      "delete": {
        "min_age": "3d",           
        "actions": {
          "delete": {}              
        }
      }
    }
  }
}

Index template /_template/datastream_template

{
  "index_patterns": ["datastream-*"],                 
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0,
    "index.lifecycle.name": "datastream_policy",      
    "index.lifecycle.rollover_alias": "datastream"    
  }
}

First index /datastream-000001

{
  "aliases": {
    "datastream": {
      "is_write_index": true
    }
  }
}

Added data /datastream/_doc/

{ "field" : "value"}

And when i do /datastream-*/_ilm/explain

{
    "indices": {
        "datastream-000001": {
            "index": "datastream-000001",
            "managed": true,
            "policy": "datastream_policy",
            "lifecycle_date_millis": 1558082103971,
            "phase": "hot",
            "phase_time_millis": 1558082104041,
            "action": "unfollow",
            "action_time_millis": 1558082104041,
            "step": "wait-for-follow-shard-tasks",
            "step_time_millis": 1558082104137,
            "phase_execution": {
                "policy": "datastream_policy",
                "phase_definition": {
                    "min_age": "0ms",
                    "actions": {
                        "rollover": {
                            "max_size": "1mb",
                            "max_age": "1m"
                        }
                    }
                },
                "version": 5,
                "modified_date_in_millis": 1558082086879
            }
        }
    }
}

But my index doesn't do rollover. What am i doing wrong?

Indrek

(Lee Hinman) #2

By default the poll interval for ILM is 10 minutes, if you want to test your policy (with a 1 minute rollover), you can lower that by changing the dynamic indices.lifecycle.poll_interval setting.