I'm learning about ILM and hot warm cold structure. For some reason, my indices aren't going to the cold node OR being deleted. I will show my experiment below and someone tell me what I did wrong?
I have 3 nodes and they each have these lines:
# https://node1.example.com : /etc/elasticsearch.yml
node.roles: ["master", "data_content", "data_hot", "ingest", "ml", "remote_cluster_client", "transform"]
# https://node2.example.com : /etc/elasticsearch.yml
node.roles: ["master", "data_content", "data_warm", "ingest", "ml", "remote_cluster_client", "transform"]
# https://node3.example.com : /etc/elasticsearch.yml
node.roles: ["master", "data_content", "data_cold", "ingest", "ml", "remote_cluster_client", "transform"]
I then did this:
# set up policy
PUT _ilm/policy/hot-warm-cold-policy
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "5m"
}
}
},
"warm": {
"min_age": "5m",
"actions": {
"allocate": {
"require": {
"data": "warm"
}
},
"forcemerge": {
"max_num_segments": 1
},
"set_priority": {
"priority": 50
}
}
},
"cold": {
"min_age": "10m",
"actions": {
"allocate": {
"require": {
"data": "cold"
}
},
"set_priority": {
"priority": 0
}
}
},
"delete": {
"min_age": "15m",
"actions": {
"delete": {}
}
}
}
}
}
# make index template
PUT _index_template/my_template
{
"index_patterns": ["my-index-*"],
"template": {
"settings": {
"index.lifecycle.name": "hot-warm-cold-policy",
"index.lifecycle.rollover_alias": "my-index-alias"
}
}
}
# make index
PUT /my-index-000001
{
"aliases": {
"my-index-alias": {
"is_write_index": true
}
}
}
Then I inserted some docs at random times throughout the hour like this:
POST /my-index-alias/_doc
{
"user": "john_doe",
"message": "I am hungry",
"created_at": "2024-08-04T10:00:00Z"
}
I waited maybe 90 minutes or so, maybe longer, i can't remember, then I ran this command:
GET my-index-alias/_ilm/explain
Which gave me this:
{
"indices": {
"my-index-000004": {
"index": "my-index-000004",
"managed": true,
"policy": "hot-warm-cold-policy",
"index_creation_date_millis": 1723062677730,
"time_since_index_creation": "1.04h",
"lifecycle_date_millis": 1723062677730,
"age": "1.04h",
"phase": "hot",
"phase_time_millis": 1723062677892,
"action": "rollover",
"action_time_millis": 1723062678092,
"step": "check-rollover-ready",
"step_time_millis": 1723062678092,
"phase_execution": {
"policy": "hot-warm-cold-policy",
"phase_definition": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "5m",
"min_docs": 1,
"max_primary_shard_docs": 200000000
}
}
},
"version": 1,
"modified_date_in_millis": 1723060413343
}
},
"my-index-000003": {
"index": "my-index-000003",
"managed": true,
"policy": "hot-warm-cold-policy",
"index_creation_date_millis": 1723061477730,
"time_since_index_creation": "1.37h",
"lifecycle_date_millis": 1723062677692,
"age": "1.04h",
"phase": "warm",
"phase_time_millis": 1723063277561,
"action": "allocate",
"action_time_millis": 1723063277761,
"step": "check-allocation",
"step_time_millis": 1723063277961,
"step_info": {
"message": "Waiting for [2] shards to be allocated to nodes matching the given filters",
"shards_left_to_allocate": 2,
"all_shards_active": true,
"number_of_replicas": 1
},
"phase_execution": {
"policy": "hot-warm-cold-policy",
"phase_definition": {
"min_age": "5m",
"actions": {
"allocate": {
"include": {},
"exclude": {},
"require": {
"data": "warm"
}
},
"forcemerge": {
"max_num_segments": 1
},
"set_priority": {
"priority": 50
}
}
},
"version": 1,
"modified_date_in_millis": 1723060413343
}
},
"my-index-000002": {
"index": "my-index-000002",
"managed": true,
"policy": "hot-warm-cold-policy",
"index_creation_date_millis": 1723060877731,
"time_since_index_creation": "1.54h",
"lifecycle_date_millis": 1723061477553,
"age": "1.37h",
"phase": "warm",
"phase_time_millis": 1723062077623,
"action": "allocate",
"action_time_millis": 1723062077823,
"step": "check-allocation",
"step_time_millis": 1723062077823,
"step_info": {
"message": "Waiting for [2] shards to be allocated to nodes matching the given filters",
"shards_left_to_allocate": 2,
"all_shards_active": true,
"number_of_replicas": 1
},
"phase_execution": {
"policy": "hot-warm-cold-policy",
"phase_definition": {
"min_age": "5m",
"actions": {
"allocate": {
"include": {},
"exclude": {},
"require": {
"data": "warm"
}
},
"forcemerge": {
"max_num_segments": 1
},
"set_priority": {
"priority": 50
}
}
},
"version": 1,
"modified_date_in_millis": 1723060413343
}
},
"my-index-000001": {
"index": "my-index-000001",
"managed": true,
"policy": "hot-warm-cold-policy",
"index_creation_date_millis": 1723060413733,
"time_since_index_creation": "1.67h",
"lifecycle_date_millis": 1723060877684,
"age": "1.54h",
"phase": "warm",
"phase_time_millis": 1723061367504,
"action": "allocate",
"action_time_millis": 1723061367704,
"step": "check-allocation",
"step_time_millis": 1723061367904,
"step_info": {
"message": "Waiting for [2] shards to be allocated to nodes matching the given filters",
"shards_left_to_allocate": 2,
"all_shards_active": true,
"number_of_replicas": 1
},
"phase_execution": {
"policy": "hot-warm-cold-policy",
"phase_definition": {
"min_age": "5m",
"actions": {
"allocate": {
"include": {},
"exclude": {},
"require": {
"data": "warm"
}
},
"forcemerge": {
"max_num_segments": 1
},
"set_priority": {
"priority": 50
}
}
},
"version": 1,
"modified_date_in_millis": 1723060413343
}
}
}
}
As you can see my my-index-000001
is just sitting in warm. Did I do something wrong?