I am trying to add a deletion phase in an existing policy. The policy works fine, creating new indices every day.
However, I cannot add a deletion phase. Since this is not possible from the UI, I tried with a POST :
But this does not seem to work... Why are the PUT and POST rejected - is it not possible to update it, only to create a new one that includes the delete phase?
Here is the policy:
{
"myindexpolicy" : {
"version" : 1,
"modified_date" : "2023-02-17T12:05:04.639Z",
"policy" : {
"phases" : {
"hot" : {
"min_age" : "0ms",
"actions" : {
"set_priority" : {
"priority" : 100
},
"rollover" : {
"max_primary_shard_size" : "1gb",
"max_age" : "1d"
}
}
}
}
},
"in_use_by" : {
"indices" : [
"myindexalias-000008",
"myindexalias-000009",
"myindexalias-000015",
"myindexalias-000004",
"myindexalias-000016",
"myindexalias-000005",
"myindexalias-000006",
"myindexalias-000017",
"myindexalias-000007",
"myindexalias-000011",
"myindexalias-000012",
"myindexalias-000013",
"myindexalias-000002",
"myindexalias-000003",
"myindexalias-000014",
"myindexalias-000010"
],
"data_streams" : [ ],
"composable_templates" : [
"mts_template"
]
}
}
}
And here is the POST (also tried PUT)
POST /_ilm/policy/myindexpolicy/_update
{
"policy": {
"phases": {
"delete": {
"min_age": "30d",
"actions": {
"delete": {}
}
}
}
}
}
Here is the error message:
{
"error" : {
"root_cause" : [
{
"type" : "x_content_parse_exception",
"reason" : "[2:3] [UpdateRequest] unknown field [policy]"
}
],
"type" : "x_content_parse_exception",
"reason" : "[2:3] [UpdateRequest] unknown field [policy]"
},
"status" : 400
}
PUT gives
"error" : "Incorrect HTTP method for uri [/_ilm/policy/myindexpolicy/_update?pretty=true] and method [PUT], allowed: [POST]",
"status" : 405