Snapshot Lifecycle Management (SLM)

class elasticsearch.client.SlmClient(client)
Parameters:

client (BaseClient)

delete_lifecycle(*, policy_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes an existing snapshot lifecycle policy.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-delete-policy.html

Parameters:
  • policy_id (str) – The id of the snapshot lifecycle policy to remove

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

execute_lifecycle(*, policy_id, error_trace=None, filter_path=None, human=None, pretty=None)

Immediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-execute-lifecycle.html

Parameters:
  • policy_id (str) – The id of the snapshot lifecycle policy to be executed

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

execute_retention(*, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes any snapshots that are expired according to the policy’s retention rules.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-execute-retention.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_lifecycle(*, policy_id=None, error_trace=None, filter_path=None, human=None, pretty=None)

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

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-get-policy.html

Parameters:
  • policy_id (str | Sequence[str] | None) – Comma-separated list of snapshot lifecycle policies to retrieve

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

get_stats(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns global and policy-level statistics about actions taken by snapshot lifecycle management.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-get-stats.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_status(*, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves the status of snapshot lifecycle management (SLM).

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-get-status.html

Parameters:
Return type:

ObjectApiResponse[Any]

put_lifecycle(*, policy_id, config=None, error_trace=None, filter_path=None, human=None, master_timeout=None, name=None, pretty=None, repository=None, retention=None, schedule=None, timeout=None, body=None)

Creates or updates a snapshot lifecycle policy.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-put-policy.html

Parameters:
  • policy_id (str) – ID for the snapshot lifecycle policy you want to create or update.

  • config (Mapping[str, Any] | None) – Configuration for each snapshot created by the policy.

  • master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 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.

  • name (str | None) – 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.

  • repository (str | None) – 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.

  • retention (Mapping[str, Any] | None) – Retention rules used to retain and delete snapshots created by the policy.

  • schedule (str | None) – Periodic or absolute schedule at which the policy creates snapshots. SLM applies schedule changes immediately.

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]

start(*, error_trace=None, filter_path=None, human=None, pretty=None)

Turns on snapshot lifecycle management (SLM).

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-start.html

Parameters:
Return type:

ObjectApiResponse[Any]

stop(*, error_trace=None, filter_path=None, human=None, pretty=None)

Turns off snapshot lifecycle management (SLM).

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-stop.html

Parameters:
Return type:

ObjectApiResponse[Any]