Skip to content

Add Snapshot API edits and automation #9751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 66 additions & 17 deletions _api-reference/snapshots/cleanup-snapshot-repository.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,92 @@
---
layout: default
title: Cleanup Snapshot Repository
title: Cleanup snapshot repository
parent: Snapshot APIs
nav_order: 11
---

# Cleanup Snapshot Repository
# Cleanup snapshot repository
Introduced 1.0
{: .label .label-purple }

The Cleanup Snapshot Repository API clears a snapshot repository of data no longer referenced by any existing snapshot.
The Cleanup Snapshot Repository API removes data from a snapshot repository that is no longer referenced by any existing snapshot. This helps reclaim storage space and optimize repository performance.

<!-- spec_insert_start
api: snapshot.cleanup_repository
component: endpoints
-->
## Endpoints

```json
POST /_snapshot/<repository>/_cleanup
POST /_snapshot/{repository}/_cleanup
```
<!-- spec_insert_end -->


<!-- spec_insert_start
api: snapshot.cleanup_repository
component: path_parameters
-->
## Path parameters

| Parameter | Data type | Description |
| :--- | :--- | :--- |
| `repository` | String | The name of the snapshot repository. |
The following table lists the available path parameters.

| Parameter | Required | Data type | Description |
| :--- | :--- | :--- | :--- |
| `repository` | **Required** | String | Snapshot repository to clean up. |

<!-- spec_insert_end -->

<!-- spec_insert_start
api: snapshot.cleanup_repository
component: query_parameters
include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.

| Parameter | Data type | Description |
| Parameter | Data type | Description |
| :--- | :--- | :--- |
| `cluster_manager_timeout` | Time | The amount of time to wait for a response from the cluster manager node. Formerly called `master_timeout`. Optional. Default is 30 seconds. |
| `timeout` | Time | The amount of time to wait for the operation to complete. Optional.|
| `cluster_manager_timeout` | String | The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters]({{site.url}}{{site.baseurl}}/api-reference/common-parameters/#time-units). |
| `timeout` | String | The amount of time to wait for a response. |

<!-- spec_insert_end -->

<!-- spec_insert_start
api: snapshot.cleanup_repository
component: request_body_parameters
-->
<!-- API snapshot.cleanup_repository does NOT have a request_body_parameters component -->
<!-- spec_insert_end -->

<!-- spec_insert_start
api: snapshot.cleanup_repository
component: response_body_parameters
-->
## Response body fields

The response body is a JSON object with the following fields.

| Property | Required | Data type | Description |
| :--- | :--- | :--- | :--- |
| `results` | **Required** | Object | Details the results and metrics of the snapshot cleanup operation. |

<details markdown="block" name="snapshot.cleanup_repository::response_body">
<summary>
Response body fields: <code>results</code>
</summary>
{: .text-delta}

`results` is a JSON object with the following fields.

| Property | Required | Data type | Description |
| :--- | :--- | :--- | :--- |
| `deleted_blobs` | **Required** | Integer | The number of binary large objects (blobs) removed during cleanup. |
| `deleted_bytes` | **Required** | Integer | The number of bytes freed by cleanup operations. |

</details>
<!-- spec_insert_end -->


## Example request

Expand All @@ -54,10 +109,4 @@ POST /_snapshot/my_backup/_cleanup
}
```

## Response body fields

| Field | Data type | Description |
| :--- | :--- | :--- |
| `deleted_bytes` | Integer | The number of bytes made available in the snapshot after data deletion. |
| `deleted_blobs` | Integer | The number of binary large objects (BLOBs) cleared from the repository by the request. |

22 changes: 19 additions & 3 deletions _api-reference/snapshots/clone-snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ nav_order: 10
Introduced 1.0
{: .label .label-purple }

Creates a clone of all or part of a snapshot in the same repository as the original.

The Clone Snapshot API creates a copy of all or part of an existing snapshot within the same repository. This is useful when you want to preserve a specific version of a snapshot while continuing to modify the original.

<!-- spec_insert_start
api: snapshot.clone
Expand All @@ -32,7 +31,7 @@ The following table lists the available path parameters.

| Parameter | Required | Data type | Description |
| :--- | :--- | :--- | :--- |
| `repository` | **Required** | String | The name of repository which will contain the snapshots clone. |
| `repository` | **Required** | String | The name of the repository that contains the source snapshot and where the cloned snapshot will be stored. |
| `snapshot` | **Required** | String | The name of the original snapshot. |
| `target_snapshot` | **Required** | String | The name of the cloned snapshot. |

Expand All @@ -55,6 +54,23 @@ The following table lists the available query parameters. All query parameters a
<!-- spec_insert_end -->


<!-- spec_insert_start
api: snapshot.clone
component: request_body_parameters
-->
## Request body fields

The snapshot clone definition.

The request body is __required__. It is a JSON object with the following fields.

| Property | Required | Data type | Description |
| :--- | :--- | :--- | :--- |
| `indices` | **Required** | String | A comma-separated list of index patterns to clone from the source snapshot. Wildcards are supported. |

<!-- spec_insert_end -->


## Example request

The following request clones indexes `index_a` and `index_b` from `my_snapshot`, a snapshot located in the snapshot repository `my-opensearch-repo`, into a new snapshot in the same repository called `my_new_snapshot`:
Expand Down
Loading