If the specified policy exists, it is replaced and the policy version is incremented.
NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions. ##Required authorization
- Index privileges:
manage* Cluster privileges:manage_ilm
Query parameters
-
Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
Values are
-1or0. -
Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
Values are
-1or0.
Body
-
Hide policy attributes Show policy attributes object
-
Hide phases attributes Show phases attributes object
-
Hide cold attributes Show cold attributes object
-
Hide actions attributes Show actions attributes object
-
Hide allocate attributes Show allocate attributes object
-
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Durationwith additional units:w(week),M(month),q(quarter) andy(year) -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
Hide rollover attributes Show rollover attributes object
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
Hide shrink attributes Show shrink attributes object
-
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
Hide delete attributes Show delete attributes object
-
Hide actions attributes Show actions attributes object
-
Hide allocate attributes Show allocate attributes object
-
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Durationwith additional units:w(week),M(month),q(quarter) andy(year) -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
Hide rollover attributes Show rollover attributes object
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
Hide shrink attributes Show shrink attributes object
-
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
Hide frozen attributes Show frozen attributes object
-
Hide actions attributes Show actions attributes object
-
Hide allocate attributes Show allocate attributes object
-
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Durationwith additional units:w(week),M(month),q(quarter) andy(year) -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
Hide rollover attributes Show rollover attributes object
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
Hide shrink attributes Show shrink attributes object
-
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
Hide hot attributes Show hot attributes object
-
Hide actions attributes Show actions attributes object
-
Hide allocate attributes Show allocate attributes object
-
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Durationwith additional units:w(week),M(month),q(quarter) andy(year) -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
Hide rollover attributes Show rollover attributes object
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
Hide shrink attributes Show shrink attributes object
-
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
Hide warm attributes Show warm attributes object
-
Hide actions attributes Show actions attributes object
-
Hide allocate attributes Show allocate attributes object
-
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Durationwith additional units:w(week),M(month),q(quarter) andy(year) -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
Hide rollover attributes Show rollover attributes object
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
Hide shrink attributes Show shrink attributes object
-
-
A duration. Units can be
nanos,micros,ms(milliseconds),s(seconds),m(minutes),h(hours) andd(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
-
-
-
PUT _ilm/policy/my-lifecycle-policy
{
"policy": {
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "50gb"
}
}
},
"warm": {
"min_age": "30d",
"actions": {
"shrink": {
"number_of_shards": 1
},
"forcemerge": {
"max_num_segments": 1
}
}
},
"cold": {
"min_age": "60d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"frozen": {
"min_age": "90d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"delete": {
"min_age": "735d",
"actions": {
"delete": {}
}
}
}
}
}
curl \
--request PUT 'http://api.example.com/_ilm/policy/{policy}' \
--header "Content-Type: application/json" \
--data '"{\n \"policy\": {\n \"phases\": {\n \"hot\": {\n \"actions\": {\n \"rollover\": {\n \"max_primary_shard_size\": \"50gb\"\n }\n }\n },\n \"warm\": {\n \"min_age\": \"30d\",\n \"actions\": {\n \"shrink\": {\n \"number_of_shards\": 1\n },\n \"forcemerge\": {\n \"max_num_segments\": 1\n }\n }\n },\n \"cold\": {\n \"min_age\": \"60d\",\n \"actions\": {\n \"searchable_snapshot\": {\n \"snapshot_repository\": \"found-snapshots\"\n }\n }\n },\n \"frozen\": {\n \"min_age\": \"90d\",\n \"actions\": {\n \"searchable_snapshot\": {\n \"snapshot_repository\": \"found-snapshots\"\n }\n }\n },\n \"delete\": {\n \"min_age\": \"735d\",\n \"actions\": {\n \"delete\": {}\n }\n }\n }\n }\n}"'
{
"policy": {
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "50gb"
}
}
},
"warm": {
"min_age": "30d",
"actions": {
"shrink": {
"number_of_shards": 1
},
"forcemerge": {
"max_num_segments": 1
}
}
},
"cold": {
"min_age": "60d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"frozen": {
"min_age": "90d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"delete": {
"min_age": "735d",
"actions": {
"delete": {}
}
}
}
}
}
{
"policy": {
"_meta": {
"description": "used for nginx log",
"project": {
"name": "myProject",
"department": "myDepartment"
}
},
"phases": {
"warm": {
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
}
}
},
"delete": {
"min_age": "30d",
"actions": {
"delete": {}
}
}
}
}
}
{
"acknowledged": true
}