---
type: api
title: Clone a snapshot
description: Clone part of all of a snapshot into another snapshot in the same repository.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-snapshot-clone
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-snapshot-clone
products:
  - Elasticsearch
---

# Clone a snapshot

Availability: 7.10+

## Paths

- `PUT` `/_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/authentication#bearerauth)

#### Path Parameters

- `repository` (string Name)
  The name of the snapshot repository that both source and target snapshot belong to.
- `snapshot` (string Name)
  The source snapshot name.
- `target_snapshot` (string Name)
  The target snapshot name.

## Description

Clone part of all of a snapshot into another snapshot in the same repository.

## Required authorization

* Cluster privileges: `manage`

## Query String Parameters

- `master_timeout` (string Duration · default: 30s)
  The period to wait for the master node.
If the master node is not available before the timeout expires, the request fails and returns an error.
To indicate that the request should never timeout, set it to `-1`.

## Request Body

`application/json`

- `indices` (string) — required
  A comma-separated list of indices to include in the snapshot.
Multi-target syntax is supported.

## Response

`application/json`

- `acknowledged` (boolean)
  For a successful response, this value is always true. On failure, an exception is returned instead.
## Code Examples

#### Console

```console
PUT /_snapshot/my_repository/source_snapshot/_clone/target_snapshot
{
  "indices": "index_a,index_b"
}
```

#### JavaScript

```javascript
const response = await client.snapshot.clone({
  repository: "my_repository",
  snapshot: "source_snapshot",
  target_snapshot: "target_snapshot",
  indices: "index_a,index_b",
});
```

#### Python

```python
resp = client.snapshot.clone(
    repository="my_repository",
    snapshot="source_snapshot",
    target_snapshot="target_snapshot",
    indices="index_a,index_b",
)
```

#### curl

```curl
curl -X PUT "$ELASTICSEARCH_URL/_snapshot/my_repository/source_snapshot/_clone/target_snapshot" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "indices": "index_a,index_b"
  }'
```

#### Java

```java
client.snapshot().clone(c -> c
    .indices("index_a,index_b")
    .repository("my_repository")
    .snapshot("source_snapshot")
    .targetSnapshot("target_snapshot")
);
```

#### C#

```c#
var response = await client.Snapshot
    .CloneAsync(repository: "my_repository", snapshot: "source_snapshot", targetSnapshot: "target_snapshot", d1 => d1
        .Indices("index_a,index_b")
    );
```

#### PHP

```php
$resp = $client->snapshot()->clone([
    "repository" => "my_repository",
    "snapshot" => "source_snapshot",
    "target_snapshot" => "target_snapshot",
    "body" => [
        "indices" => "index_a,index_b",
    ],
]);
```

#### Ruby

```ruby
response = client.snapshot.clone(
  repository: "my_repository",
  snapshot: "source_snapshot",
  target_snapshot: "target_snapshot",
  body: {
    "indices": "index_a,index_b"
  }
)
```

