Create or update a lifecycle policy Added in 6.6.0
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.
Path parameters
-
Identifier for the policy.
Query parameters
-
master_timeout string
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.
-
timeout string
Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.
Body
-
policy object
Additional properties are allowed.
Hide policy attributes Show policy attributes object
-
Additional properties are allowed.
Hide phases attributes Show phases attributes object
-
cold object
Additional properties are allowed.
Hide cold attributes Show cold attributes object
-
actions object
Additional properties are allowed.
Hide actions attributes Show actions attributes object
-
allocate object
Additional properties are allowed.
Hide allocate attributes Show allocate attributes object
-
number_of_replicas number
-
total_shards_per_node number
-
include object
Hide include attribute Show include attribute object
-
exclude object
Hide exclude attribute Show exclude attribute object
-
require object
Hide require attribute Show require attribute object
-
-
delete object
Additional properties are allowed.
Hide delete attribute Show delete attribute object
-
delete_searchable_snapshot boolean
-
-
downsample object
Additional properties are allowed.
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Duration
with additional units:w
(week),M
(month),q
(quarter) andy
(year) -
wait_timeout string
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.
-
-
freeze object
Additional properties are allowed.
-
forcemerge object
Additional properties are allowed.
Hide forcemerge attributes Show forcemerge attributes object
-
index_codec string
-
migrate object
Additional properties are allowed.
Hide migrate attribute Show migrate attribute object
-
enabled boolean
-
-
readonly object
Additional properties are allowed.
-
rollover object
Additional properties are allowed.
Hide rollover attributes Show rollover attributes object
max_size number | string
max_primary_shard_size number | string
-
max_age string
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. -
max_docs number
-
max_primary_shard_docs number
min_size number | string
min_primary_shard_size number | string
-
min_age string
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. -
min_docs number
-
min_primary_shard_docs number
-
set_priority object
Additional properties are allowed.
Hide set_priority attribute Show set_priority attribute object
-
priority number
-
-
searchable_snapshot object
Additional properties are allowed.
Hide searchable_snapshot attributes Show searchable_snapshot attributes object
-
force_merge_index boolean
-
shrink object
Additional properties are allowed.
Hide shrink attributes Show shrink attributes object
-
number_of_shards number
max_primary_shard_size number | string
-
allow_write_after_shrink boolean
-
-
unfollow object
Additional properties are allowed.
-
wait_for_snapshot object
Additional properties are allowed.
Hide wait_for_snapshot attribute Show wait_for_snapshot attribute object
-
-
-
delete object
Additional properties are allowed.
Hide delete attributes Show delete attributes object
-
actions object
Additional properties are allowed.
Hide actions attributes Show actions attributes object
-
allocate object
Additional properties are allowed.
Hide allocate attributes Show allocate attributes object
-
number_of_replicas number
-
total_shards_per_node number
-
include object
Hide include attribute Show include attribute object
-
exclude object
Hide exclude attribute Show exclude attribute object
-
require object
Hide require attribute Show require attribute object
-
-
delete object
Additional properties are allowed.
Hide delete attribute Show delete attribute object
-
delete_searchable_snapshot boolean
-
-
downsample object
Additional properties are allowed.
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Duration
with additional units:w
(week),M
(month),q
(quarter) andy
(year) -
wait_timeout string
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.
-
-
freeze object
Additional properties are allowed.
-
forcemerge object
Additional properties are allowed.
Hide forcemerge attributes Show forcemerge attributes object
-
index_codec string
-
migrate object
Additional properties are allowed.
Hide migrate attribute Show migrate attribute object
-
enabled boolean
-
-
readonly object
Additional properties are allowed.
-
rollover object
Additional properties are allowed.
Hide rollover attributes Show rollover attributes object
max_size number | string
max_primary_shard_size number | string
-
max_age string
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. -
max_docs number
-
max_primary_shard_docs number
min_size number | string
min_primary_shard_size number | string
-
min_age string
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. -
min_docs number
-
min_primary_shard_docs number
-
set_priority object
Additional properties are allowed.
Hide set_priority attribute Show set_priority attribute object
-
priority number
-
-
searchable_snapshot object
Additional properties are allowed.
Hide searchable_snapshot attributes Show searchable_snapshot attributes object
-
force_merge_index boolean
-
shrink object
Additional properties are allowed.
Hide shrink attributes Show shrink attributes object
-
number_of_shards number
max_primary_shard_size number | string
-
allow_write_after_shrink boolean
-
-
unfollow object
Additional properties are allowed.
-
wait_for_snapshot object
Additional properties are allowed.
Hide wait_for_snapshot attribute Show wait_for_snapshot attribute object
-
-
-
frozen object
Additional properties are allowed.
Hide frozen attributes Show frozen attributes object
-
actions object
Additional properties are allowed.
Hide actions attributes Show actions attributes object
-
allocate object
Additional properties are allowed.
Hide allocate attributes Show allocate attributes object
-
number_of_replicas number
-
total_shards_per_node number
-
include object
Hide include attribute Show include attribute object
-
exclude object
Hide exclude attribute Show exclude attribute object
-
require object
Hide require attribute Show require attribute object
-
-
delete object
Additional properties are allowed.
Hide delete attribute Show delete attribute object
-
delete_searchable_snapshot boolean
-
-
downsample object
Additional properties are allowed.
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Duration
with additional units:w
(week),M
(month),q
(quarter) andy
(year) -
wait_timeout string
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.
-
-
freeze object
Additional properties are allowed.
-
forcemerge object
Additional properties are allowed.
Hide forcemerge attributes Show forcemerge attributes object
-
index_codec string
-
migrate object
Additional properties are allowed.
Hide migrate attribute Show migrate attribute object
-
enabled boolean
-
-
readonly object
Additional properties are allowed.
-
rollover object
Additional properties are allowed.
Hide rollover attributes Show rollover attributes object
max_size number | string
max_primary_shard_size number | string
-
max_age string
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. -
max_docs number
-
max_primary_shard_docs number
min_size number | string
min_primary_shard_size number | string
-
min_age string
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. -
min_docs number
-
min_primary_shard_docs number
-
set_priority object
Additional properties are allowed.
Hide set_priority attribute Show set_priority attribute object
-
priority number
-
-
searchable_snapshot object
Additional properties are allowed.
Hide searchable_snapshot attributes Show searchable_snapshot attributes object
-
force_merge_index boolean
-
shrink object
Additional properties are allowed.
Hide shrink attributes Show shrink attributes object
-
number_of_shards number
max_primary_shard_size number | string
-
allow_write_after_shrink boolean
-
-
unfollow object
Additional properties are allowed.
-
wait_for_snapshot object
Additional properties are allowed.
Hide wait_for_snapshot attribute Show wait_for_snapshot attribute object
-
-
-
hot object
Additional properties are allowed.
Hide hot attributes Show hot attributes object
-
actions object
Additional properties are allowed.
Hide actions attributes Show actions attributes object
-
allocate object
Additional properties are allowed.
Hide allocate attributes Show allocate attributes object
-
number_of_replicas number
-
total_shards_per_node number
-
include object
Hide include attribute Show include attribute object
-
exclude object
Hide exclude attribute Show exclude attribute object
-
require object
Hide require attribute Show require attribute object
-
-
delete object
Additional properties are allowed.
Hide delete attribute Show delete attribute object
-
delete_searchable_snapshot boolean
-
-
downsample object
Additional properties are allowed.
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Duration
with additional units:w
(week),M
(month),q
(quarter) andy
(year) -
wait_timeout string
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.
-
-
freeze object
Additional properties are allowed.
-
forcemerge object
Additional properties are allowed.
Hide forcemerge attributes Show forcemerge attributes object
-
index_codec string
-
migrate object
Additional properties are allowed.
Hide migrate attribute Show migrate attribute object
-
enabled boolean
-
-
readonly object
Additional properties are allowed.
-
rollover object
Additional properties are allowed.
Hide rollover attributes Show rollover attributes object
max_size number | string
max_primary_shard_size number | string
-
max_age string
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. -
max_docs number
-
max_primary_shard_docs number
min_size number | string
min_primary_shard_size number | string
-
min_age string
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. -
min_docs number
-
min_primary_shard_docs number
-
set_priority object
Additional properties are allowed.
Hide set_priority attribute Show set_priority attribute object
-
priority number
-
-
searchable_snapshot object
Additional properties are allowed.
Hide searchable_snapshot attributes Show searchable_snapshot attributes object
-
force_merge_index boolean
-
shrink object
Additional properties are allowed.
Hide shrink attributes Show shrink attributes object
-
number_of_shards number
max_primary_shard_size number | string
-
allow_write_after_shrink boolean
-
-
unfollow object
Additional properties are allowed.
-
wait_for_snapshot object
Additional properties are allowed.
Hide wait_for_snapshot attribute Show wait_for_snapshot attribute object
-
-
-
warm object
Additional properties are allowed.
Hide warm attributes Show warm attributes object
-
actions object
Additional properties are allowed.
Hide actions attributes Show actions attributes object
-
allocate object
Additional properties are allowed.
Hide allocate attributes Show allocate attributes object
-
number_of_replicas number
-
total_shards_per_node number
-
include object
Hide include attribute Show include attribute object
-
exclude object
Hide exclude attribute Show exclude attribute object
-
require object
Hide require attribute Show require attribute object
-
-
delete object
Additional properties are allowed.
Hide delete attribute Show delete attribute object
-
delete_searchable_snapshot boolean
-
-
downsample object
Additional properties are allowed.
Hide downsample attributes Show downsample attributes object
-
A date histogram interval. Similar to
Duration
with additional units:w
(week),M
(month),q
(quarter) andy
(year) -
wait_timeout string
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.
-
-
freeze object
Additional properties are allowed.
-
forcemerge object
Additional properties are allowed.
Hide forcemerge attributes Show forcemerge attributes object
-
index_codec string
-
migrate object
Additional properties are allowed.
Hide migrate attribute Show migrate attribute object
-
enabled boolean
-
-
readonly object
Additional properties are allowed.
-
rollover object
Additional properties are allowed.
Hide rollover attributes Show rollover attributes object
max_size number | string
max_primary_shard_size number | string
-
max_age string
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. -
max_docs number
-
max_primary_shard_docs number
min_size number | string
min_primary_shard_size number | string
-
min_age string
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. -
min_docs number
-
min_primary_shard_docs number
-
set_priority object
Additional properties are allowed.
Hide set_priority attribute Show set_priority attribute object
-
priority number
-
-
searchable_snapshot object
Additional properties are allowed.
Hide searchable_snapshot attributes Show searchable_snapshot attributes object
-
force_merge_index boolean
-
shrink object
Additional properties are allowed.
Hide shrink attributes Show shrink attributes object
-
number_of_shards number
max_primary_shard_size number | string
-
allow_write_after_shrink boolean
-
-
unfollow object
Additional properties are allowed.
-
wait_for_snapshot object
Additional properties are allowed.
Hide wait_for_snapshot attribute Show wait_for_snapshot attribute object
-
-
-
-
_meta object
Hide _meta attribute Show _meta attribute object
-
Additional properties are allowed.
-
-
curl \
-X PUT http://api.example.com/_ilm/policy/{policy} \
-H "Content-Type: application/json" \
-d '"{\n \"policy\": {\n \"_meta\": {\n \"description\": \"used for nginx log\",\n \"project\": {\n \"name\": \"myProject\",\n \"department\": \"myDepartment\"\n }\n },\n \"phases\": {\n \"warm\": {\n \"min_age\": \"10d\",\n \"actions\": {\n \"forcemerge\": {\n \"max_num_segments\": 1\n }\n }\n },\n \"delete\": {\n \"min_age\": \"30d\",\n \"actions\": {\n \"delete\": {}\n }\n }\n }\n }\n}"'
{
"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
}