Get snapshot lifecycle policy API
editGet snapshot lifecycle policy API
editRetrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts.
Prerequisites
editIf the Elasticsearch security features are enabled, you must have the manage_slm
cluster privilege to use this API. For more information, see
Security privileges.
Description
editReturns the specified policy definition and information about the latest successful and failed attempts to create snapshots. If no policy is specified, returns all defined policies.
Path parameters
edit-
<policy-id>
- (Optional, string) Comma-separated list of snapshot lifecycle policy IDs.
Examples
editGet a specific policy
editGet the daily-snapshots
policy:
resp = client.slm.get_lifecycle( policy_id="daily-snapshots", human=True, ) print(resp)
response = client.slm.get_lifecycle( policy_id: 'daily-snapshots', human: true ) puts response
const response = await client.slm.getLifecycle({ policy_id: "daily-snapshots", human: "true", }); console.log(response);
GET _slm/policy/daily-snapshots?human
This request returns the following response:
{ "daily-snapshots": { "version": 1, "modified_date": "2099-05-06T01:30:00.000Z", "modified_date_millis": 4081757400000, "policy" : { "schedule": "0 30 1 * * ?", "name": "<daily-snap-{now/d}>", "repository": "my_repository", "config": { "indices": ["data-*", "important"], "ignore_unavailable": false, "include_global_state": false }, "retention": { "expire_after": "30d", "min_count": 5, "max_count": 50 } }, "stats": { "policy": "daily-snapshots", "snapshots_taken": 0, "snapshots_failed": 0, "snapshots_deleted": 0, "snapshot_deletion_failures": 0 }, "next_execution": "2099-05-07T01:30:00.000Z", "next_execution_millis": 4081843800000 } }
Get all policies
editresp = client.slm.get_lifecycle() print(resp)
response = client.slm.get_lifecycle puts response
const response = await client.slm.getLifecycle(); console.log(response);
GET _slm/policy