Elasticsearch Index Management

PUT _opendistro/_ism/policies/test-archive
{
"policy": {
"description": "A simple default policy that archives logs after 15 days.",
"default_state": "hot",
"states": [
{
"name": "hot",
"actions": [],
"transitions": [
{
"state_name": "delete",
"conditions": {
"min_index_age": "15d"
}
}
]
},
{
"name": "delete",
"actions": [
{
"delete": {}
}
],
"transitions": []
}
],
"ism_template": {
"index_patterns": ["logs-to-be-archive-*"],
"priority": 100
}
}
}
PUT _ilm/policy/test-archive
{
"policy": {
"_meta": {
"description": "A simple default policy that archives logs after 15 days.",
"project": {
"name": "myProject",
"department": "myDepartment"
}
},
"phases": {
"delete": {
"min_age": "15d",
"actions": {
"delete": {}
}
}
}
}
}
PUT _index_template/timeseries_template
{
"index_patterns": ["logs-to-be-archive-*"],
"template": {
"settings": {
"index.lifecycle.name": "test-archive"
}
}
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store