IMPORTANT: Version 6.7 of Elasticsearch has passed its maintenance date.
This documentation is no longer being updated. For the latest information, see the current release documentation.
There are many new features introduced by ILM, but we will only focus on a few that are needed for our example. For starters, we will use the Put Policy API to define our first policy. Lifecycle policies are defined in JSON and include specific phases and actions.
call to the put lifecycle API endpoint to create a new policy named "datastream_policy"
policy definition sub-object
the hot phase defined in the "phases" section. Optional
rollover action definition
delete phase begins after 90 days
delete action definition
Here we created the policy called
datastream_policy which rolls over
the index being written to after it reaches 50 gigabytes, or it is 30
days old. The rollover will occur when either of these conditions is true.
The index will be deleted 90 days after it is rolled over.