Create or update a policy
- PUT /_slm/policy/{policy_id}
Create or update a snapshot lifecycle policy. If the policy already exists, this request increments the policy version. Only the latest version of a policy is stored.
- Index privileges:
manage - Cluster privileges:
manage_slm
Path Parameters
-
policy_idstring Namerequired -
The identifier for the snapshot lifecycle policy you want to create or update.
Query Parameters
-
master_timeoutstring Duration · default: 30s The period 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. To indicate that the request should never timeout, set it to
-1.-
timeoutstring Duration · default: 30s The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to
-1.
Request
-
configConfiguration -
Configuration for each snapshot created by the policy.
-
If false, the snapshot fails if any data stream or index in indices is missing or closed. If true, the snapshot ignores missing or closed data streams and indices.
-
indicesstring Indices -
A comma-separated list of data streams and indices to include in the snapshot. Multi-index syntax is supported. By default, a snapshot includes all data streams and indices in the cluster. If this argument is provided, the snapshot only includes the specified data streams and clusters.
-
include_global_stateboolean · default: true -
If true, the current global state is included in the snapshot.
-
feature_statesstring -
A list of feature states to be included in this snapshot. A list of features available for inclusion in the snapshot and their descriptions be can be retrieved using the get features API. Each feature state includes one or more system indices containing data necessary for the function of that feature. Providing an empty array will include no feature states in the snapshot, regardless of the value of include_global_state. By default, all available feature states will be included in the snapshot if include_global_state is true, or no feature states if include_global_state is false.
-
metadataMetadata -
Attaches arbitrary metadata to the snapshot, such as a record of who took the snapshot, why it was taken, or any other useful data. Metadata must be less than 1024 bytes.
-
partialboolean · default: false -
If false, the entire snapshot will fail if one or more indices included in the snapshot do not have all primary shards available.
-
namestring Name -
Name automatically assigned to each snapshot created by the policy. Date math is supported. To prevent conflicting snapshot names, a UUID is automatically appended to each snapshot name.
-
repositorystring -
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.
-
retentionRetention -
Retention rules used to retain and delete snapshots created by the policy.
-
expire_afterstring Durationrequired -
Time period after which a snapshot is considered expired and eligible for deletion. SLM deletes expired snapshots based on the slm.retention_schedule.
-
max_countnumberrequired -
Maximum number of snapshots to retain, even if the snapshots have not yet expired. If the number of snapshots in the repository exceeds this limit, the policy retains the most recent snapshots and deletes older snapshots.
-
min_countnumberrequired -
Minimum number of snapshots to retain, even if the snapshots have expired.
-
schedulestring -
Periodic or absolute schedule at which the policy creates snapshots. SLM applies schedule changes immediately.
Response
-
acknowledgedbooleanrequired -
For a successful response, this value is always true. On failure, an exception is returned instead.