Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include a default index-lifecycle policies #14

Open
tdmakepeace opened this issue Mar 13, 2024 · 1 comment
Open

Include a default index-lifecycle policies #14

tdmakepeace opened this issue Mar 13, 2024 · 1 comment

Comments

@tdmakepeace
Copy link

by default no index life cycle policy is defined, so when you attempt to create one, any index created prior to the creation of the new index-lifecycle-policy has to be manually managed.
by creating and assigning a default policy, it can be edited, or a new one created, but it means all existing indexes are still managed from a lifecycle perspective.

@tdmakepeace
Copy link
Author

To set an index policy the status needs to be green, if you are running a single node, then you need to update the default replicas to "0"

example.

curl -q -s "http://localhost:9200/_cat/shards" |grep UNASSIGNED |cut -c 1-25

curl -X PUT -H "Content-Type: application/json" "http://localhost:9200/pensando-fwlog-2024.02.21/_settings" -d '{ "number_of_replicas": 0 }'

Assign a lifecycle policy to existing index's

PUT _snapshot/my_fs_backup
{
"type": "fs",
"settings": {
"location": "/usr/share/elasticsearch/backups"
}
}

PUT _slm/policy/pensando
{
"name": "<pensando-snap-{now/d}>",
"schedule": "0 30 0 * * ?",
"repository": "my_fs_backup",
"config": {
"indices": [
"pensando*"
],
"ignore_unavailable": false,
"include_global_state": true,
"feature_states": [],
"partial": true
},
"retention": {
"expire_after": "7d"
}
}

PUT _ilm/policy/pensando
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"set_priority": {
"priority": 100
}
}
},
"warm": {
"min_age": "14d",
"actions": {
"set_priority": {
"priority": 50
}
}
},
"delete": {
"min_age": "30d",
"actions": {
"delete": {
"delete_searchable_snapshot": true
},
"wait_for_snapshot": {
"policy": "daily"
}
}
}
}
}
}

curl -X PUT -H "Content-Type: application/json" "http://localhost:9200/pensando-fwlog-2024.03.12/_settings" -d '{ "lifecycle.name": "pensando" }'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant