Snapshots
- class elasticsearch.client.SnapshotClient(client)
- Parameters:
client (BaseClient)
- cleanup_repository(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)
Triggers the review of a snapshot repository’s contents and deletes any stale data not referenced by existing snapshots.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/clean-up-snapshot-repo-api.html
- Parameters:
name (str) – Snapshot repository to clean up.
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a connection to the master node.
timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a response.
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- clone(*, repository, snapshot, target_snapshot, indices=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None, body=None)
Clones indices from one snapshot into another snapshot in the same repository.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
repository (str) – A repository name
snapshot (str) – The name of the snapshot to clone from
target_snapshot (str) – The name of the cloned snapshot to create
indices (str | None)
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout for connection to master node
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- create(*, repository, snapshot, error_trace=None, feature_states=None, filter_path=None, human=None, ignore_unavailable=None, include_global_state=None, indices=None, master_timeout=None, metadata=None, partial=None, pretty=None, wait_for_completion=None, body=None)
Creates a snapshot in a repository.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
repository (str) – Repository for the snapshot.
snapshot (str) – Name of the snapshot. Must be unique in the repository.
feature_states (Sequence[str] | None) – Feature states to include in the snapshot. Each feature state includes one or more system indices containing related data. You can view a list of eligible features using the get features API. If include_global_state is true, all current feature states are included by default. If include_global_state is false, no feature states are included by default.
ignore_unavailable (bool | None) – If true, the request ignores data streams and indices in indices that are missing or closed. If false, the request returns an error for any data stream or index that is missing or closed.
include_global_state (bool | None) – If true, the current cluster state is included in the snapshot. The cluster state includes persistent cluster settings, composable index templates, legacy index templates, ingest pipelines, and ILM policies. It also includes data stored in system indices, such as Watches and task records (configurable via feature_states).
indices (str | Sequence[str] | None) – Data streams and indices to include in the snapshot. Supports multi-target syntax. Includes all data streams and indices by default.
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.
metadata (Mapping[str, Any] | None) – Optional metadata for the snapshot. May have any contents. Must be less than 1024 bytes. This map is not automatically generated by Elasticsearch.
partial (bool | None) – If true, allows restoring a partial snapshot of indices with unavailable shards. Only shards that were successfully included in the snapshot will be restored. All missing shards will be recreated as empty. If false, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available.
wait_for_completion (bool | None) – If true, the request returns a response when the snapshot is complete. If false, the request returns a response when the snapshot initializes.
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- create_repository(*, name, repository=None, body=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None, verify=None)
Creates a repository.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
name (str) – A repository name
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout for connection to master node
timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout
verify (bool | None) – Whether to verify the repository after creation
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- delete(*, repository, snapshot, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)
Deletes one or more snapshots.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
- Return type:
- delete_repository(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)
Deletes a repository.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
name (str | Sequence[str]) – Name of the snapshot repository to unregister. Wildcard (*) patterns are supported.
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout for connection to master node
timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- get(*, repository, snapshot, after=None, error_trace=None, filter_path=None, from_sort_value=None, human=None, ignore_unavailable=None, include_repository=None, index_details=None, index_names=None, master_timeout=None, offset=None, order=None, pretty=None, size=None, slm_policy_filter=None, sort=None, verbose=None)
Returns information about a snapshot.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
repository (str) – Comma-separated list of snapshot repository names used to limit the request. Wildcard (*) expressions are supported.
snapshot (str | Sequence[str]) – Comma-separated list of snapshot names to retrieve. Also accepts wildcards (*). - To get information about all snapshots in a registered repository, use a wildcard (*) or _all. - To get information about any snapshots that are currently running, use _current.
after (str | None) – Offset identifier to start pagination from as returned by the next field in the response body.
from_sort_value (str | None) – Value of the current sort column at which to start retrieval. Can either be a string snapshot- or repository name when sorting by snapshot or repository name, a millisecond time value or a number when sorting by index- or shard count.
ignore_unavailable (bool | None) – If false, the request returns an error for any snapshots that are unavailable.
include_repository (bool | None) – If true, returns the repository name in each snapshot.
index_details (bool | None) – If true, returns additional information about each index in the snapshot comprising the number of shards in the index, the total size of the index in bytes, and the maximum number of segments per shard in the index. Defaults to false, meaning that this information is omitted.
index_names (bool | None) – If true, returns the name of each index in each snapshot.
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.
offset (int | None) – Numeric offset to start pagination from based on the snapshots matching this request. Using a non-zero value for this parameter is mutually exclusive with using the after parameter. Defaults to 0.
order (str | Literal['asc', 'desc'] | None) – Sort order. Valid values are asc for ascending and desc for descending order. Defaults to asc, meaning ascending order.
size (int | None) – Maximum number of snapshots to return. Defaults to 0 which means return all that match the request without limit.
slm_policy_filter (str | None) – Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Also accepts wildcards (*) and combinations of wildcards followed by exclude patterns starting with -. To include snapshots not created by an SLM policy you can use the special pattern _none that will match all snapshots without an SLM policy.
sort (str | Literal['duration', 'failed_shard_count', 'index_count', 'name', 'repository', 'shard_count', 'start_time'] | None) – Allows setting a sort order for the result. Defaults to start_time, i.e. sorting by snapshot start time stamp.
verbose (bool | None) – If true, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted.
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- get_repository(*, name=None, error_trace=None, filter_path=None, human=None, local=None, master_timeout=None, pretty=None)
Returns information about a repository.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
name (str | Sequence[str] | None) – A comma-separated list of repository names
local (bool | None) – Return local information, do not retrieve the state from master node (default: false)
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout for connection to master node
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- repository_verify_integrity(*, name, blob_thread_pool_concurrency=None, error_trace=None, filter_path=None, human=None, index_snapshot_verification_concurrency=None, index_verification_concurrency=None, max_bytes_per_sec=None, max_failed_shard_snapshots=None, meta_thread_pool_concurrency=None, pretty=None, snapshot_verification_concurrency=None, verify_blob_contents=None)
Verifies the integrity of the contents of a snapshot repository
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
blob_thread_pool_concurrency (int | None) – Number of threads to use for reading blob contents
index_snapshot_verification_concurrency (int | None) – Number of snapshots to verify concurrently within each index
index_verification_concurrency (int | None) – Number of indices to verify concurrently
max_bytes_per_sec (str | None) – Rate limit for individual blob verification
max_failed_shard_snapshots (int | None) – Maximum permitted number of failed shard snapshots
meta_thread_pool_concurrency (int | None) – Number of threads to use for reading metadata
snapshot_verification_concurrency (int | None) – Number of snapshots to verify concurrently
verify_blob_contents (bool | None) – Whether to verify the contents of individual blobs
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- restore(*, repository, snapshot, error_trace=None, feature_states=None, filter_path=None, human=None, ignore_index_settings=None, ignore_unavailable=None, include_aliases=None, include_global_state=None, index_settings=None, indices=None, master_timeout=None, partial=None, pretty=None, rename_pattern=None, rename_replacement=None, wait_for_completion=None, body=None)
Restores a snapshot.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
repository (str) – A repository name
snapshot (str) – A snapshot name
ignore_unavailable (bool | None)
include_aliases (bool | None)
include_global_state (bool | None)
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout for connection to master node
partial (bool | None)
rename_pattern (str | None)
rename_replacement (str | None)
wait_for_completion (bool | None) – Should this request wait until the operation has completed before returning
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- status(*, repository=None, snapshot=None, error_trace=None, filter_path=None, human=None, ignore_unavailable=None, master_timeout=None, pretty=None)
Returns information about the status of a snapshot.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
repository (str | None) – A repository name
snapshot (str | Sequence[str] | None) – A comma-separated list of snapshot names
ignore_unavailable (bool | None) – Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout for connection to master node
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- verify_repository(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)
Verifies a repository.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
- Parameters:
name (str) – A repository name
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout for connection to master node
timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Explicit operation timeout
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type: