Get snapshot lifecycle policy API

Retrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts.

Request

GET /_slm/policy/<policy-id>

GET /_slm/policy

Prerequisites

If 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

Returns 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

<policy-id>

(Optional, string) Comma-separated list of snapshot lifecycle policy IDs.

Examples

Get a specific policy

Get the daily-snapshots policy:

  1. GET /_slm/policy/daily-snapshots?human

This request returns the following response:

  1. {
  2. "daily-snapshots" : {
  3. "version": 1,
  4. "modified_date": "2019-04-23T01:30:00.000Z",
  5. "modified_date_millis": 1556048137314,
  6. "policy" : {
  7. "schedule": "0 30 1 * * ?",
  8. "name": "<daily-snap-{now/d}>",
  9. "repository": "my_repository",
  10. "config": {
  11. "indices": ["data-*", "important"],
  12. "ignore_unavailable": false,
  13. "include_global_state": false
  14. },
  15. "retention": {
  16. "expire_after": "30d",
  17. "min_count": 5,
  18. "max_count": 50
  19. }
  20. },
  21. "stats": {
  22. "policy": "daily-snapshots",
  23. "snapshots_taken": 0,
  24. "snapshots_failed": 0,
  25. "snapshots_deleted": 0,
  26. "snapshot_deletion_failures": 0
  27. },
  28. "next_execution": "2019-04-24T01:30:00.000Z",
  29. "next_execution_millis": 1556048160000
  30. }
  31. }

The version of the snapshot policy, only the latest verison is stored and incremented when the policy is updated

The last time this policy was modified.

The next time this policy will be executed.

Get all policies

  1. GET /_slm/policy