---
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/4641/api/doc/elasticsearch/operation/operation-snapshot-clone
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/operation/operation-snapshot-clone
products:
  - Elasticsearch
---

# Clone a snapshot

Authentication: required

Availability: Generally available since 7.10

## Paths

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

#### Path parameters

- `repository` (string) — required
  The name of the snapshot repository that both source and target snapshot belong to.
- `snapshot` (string) — required
  The source snapshot name.
- `target_snapshot` (string) — required
  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 · default: 30s) — optional
  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"
  }
)
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "acknowledged": false
}
```

