Creates or updates a snapshot lifecycle policy Added in 7.4.0

PUT /_slm/policy/{policy_id}

Path parameters

  • policy_id string Required

    ID for the snapshot lifecycle policy you want to create or update.

Query parameters

  • 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.

  • timeout string

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

application/json

Body

  • config object

    Additional properties are allowed.

    Hide config attributes Show config attributes object
    • 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.

    • indices string | array[string]
    • If true, the current global state is included in the snapshot.

    • feature_states array[string]

      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.

    • metadata object
      Hide metadata attribute Show metadata attribute object
      • * object Additional properties

        Additional properties are allowed.

    • partial boolean

      If false, the entire snapshot will fail if one or more indices included in the snapshot do not have all primary shards available.

  • name 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.

  • Additional properties are allowed.

    Hide retention attributes Show retention attributes object
    • expire_after string Required

      A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

    • max_count number Required

      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_count number Required

      Minimum number of snapshots to retain, even if the snapshots have expired.

  • schedule string

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • acknowledged boolean Required

      For a successful response, this value is always true. On failure, an exception is returned instead.

PUT /_slm/policy/{policy_id}
curl \
 -X PUT http://api.example.com/_slm/policy/{policy_id} \
 -H "Content-Type: application/json" \
 -d '{"config":{"ignore_unavailable":true,"indices":"string","include_global_state":true,"feature_states":["string"],"metadata":{"additionalProperty1":{},"additionalProperty2":{}},"partial":true},"name":"string","repository":"string","retention":{"expire_after":"string","max_count":42.0,"min_count":42.0},"schedule":"string"}'
Request examples
{
  "config": {
    "ignore_unavailable": true,
    "indices": "string",
    "include_global_state": true,
    "feature_states": [
      "string"
    ],
    "metadata": {
      "additionalProperty1": {},
      "additionalProperty2": {}
    },
    "partial": true
  },
  "name": "string",
  "repository": "string",
  "retention": {
    "expire_after": "string",
    "max_count": 42.0,
    "min_count": 42.0
  },
  "schedule": "string"
}
Response examples (200)
{
  "acknowledged": true
}