Put snapshot lifecycle policy API
editPut snapshot lifecycle policy API
editCreates or updates a snapshot lifecycle policy.
Request
editPUT /_slm/policy/<snapshot-lifecycle-policy-id>
Prerequisites
editIf you use Elasticsearch security features, you must have:
-
manage_slm
cluster privileges -
manage
index privileges for any included indices
Snapshot lifecycle management operations are executed as the user that last created or updated the policy.
For more information, see Security privileges.
Description
editUse the put snapshot lifecycle policy API to create or update a snapshot lifecycle policy.
If the policy already exists, this request increments the policy’s version. Only the latest version of the policy is stored.
Path parameters
edit-
<snapshot-lifecycle-policy-id>
- (Required, string) ID for the snapshot lifecycle policy you want to create or update.
Query parameters
edit-
timeout
-
(Optional, time units) Specifies the period of time to wait for
a response. If no response is received before the timeout expires, the request
fails and returns an error. Defaults to
30s
. -
master_timeout
-
(Optional, time units) Specifies the period of time to wait for
a connection to the master node. If no response is received before the timeout
expires, the request fails and returns an error. Defaults to
30s
.
Request body
edit-
schedule
-
(Required, Cron scheduler configuration) Periodic or absolute schedule at which the policy creates snapshots and deletes expired snapshots.
Schedule changes to existing policies are applied immediately.
-
name
-
(Required, string) Name automatically assigned to each snapshot created by the policy.
This value supports the same date math supported in index names.
To prevent conflicting snapshot names, a UUID is automatically appended to each snapshot name.
-
repository
-
(Required, string) Repository used to store snapshots created by this policy.
This repository must exist prior to the policy’s creation. You can create a repository using the snapshot repository API.
-
config
-
(Required, object) Configuration for each snapshot created by the policy.
Parameters include:
-
indices
- (Optional, array of strings) Array of index names or wildcard pattern of index names included in snapshots.
-
ignore_unavailable
-
(Optional, boolean)
If
true
, missing indices do not cause snapshot creation to fail and return an error. Defaults tofalse
. -
include_global_state
-
(Optional, boolean)
If
true
, cluster states are included in snapshots. Defaults tofalse
.
-
Examples
editThe following request creates a snapshot lifecycle policy
with an ID of daily-snapshots
: