# Snapshot api is not working

**URL:** <https://discuss.elastic.co/t/snapshot-api-is-not-working/204702>\
**Category:** Elasticsearch\
**Created:** [October 22, 2019, 5:36pm UTC](https://discuss.elastic.co/t/snapshot-api-is-not-working/204702 "2019-10-22T17:36:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![baselai](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@baselai](https://discuss.elastic.co/u/baselai)\
**Post date:** [October 22, 2019, 5:36pm UTC](https://discuss.elastic.co/t/snapshot-api-is-not-working/204702/1 "2019-10-22T17:36:34Z")

</div>

I have the following code:

```auto
curl -X PUT "localhost:9200/_snapshot/backup?wait_for_completion=true" -H'Content-Type:application/json' -d '{
"indices": "index_1",  
”type": "fs",
  "settings": {
    "location": "/Users/basela/Desktop/ElasticBackup",
    "compress": true
  }
}'

```

I have two elasticsearch instances, instance 1 running on Server A, and instance 2 running on Server B.

I want to move a specific **index** from Server A to Server B only, without overwriting the indexes on Server B.

But I'm getting this error and I don't know the reason!

```auto
{"Message":"Your request: '/_snapshot/backup?wait_for_completion=true' is not allowed due to invalid input parameters."}

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 23, 2019, 1:17am UTC](https://discuss.elastic.co/t/snapshot-api-is-not-working/204702/2 "2019-10-23T01:17:38Z")

</div>

Could you try without

```
?wait_for_completion=true
```

---

<div class="post-metadata">

**Author:** ![sandeepkanabar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepkanabar/32/79399_2.png) [@sandeepkanabar](https://discuss.elastic.co/u/sandeepkanabar)\
**Post date:** [October 23, 2019, 6:59am UTC](https://discuss.elastic.co/t/snapshot-api-is-not-working/204702/3 "2019-10-23T06:59:41Z")

</div>

The command that you are trying is for [creating repository](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/modules-snapshots.html#snapshots-repositories). As @dadoonet said, remove `?wait_for_completion=true` and also remove `"indices": "index_1"`. You specify indices when actually doing the [snapshot](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/modules-snapshots.html#snapshots-take-snapshot) not while creating repository.

---

<div class="post-metadata">

**Author:** ![baselai](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@baselai](https://discuss.elastic.co/u/baselai)\
**Post date:** [October 23, 2019, 2:02pm UTC](https://discuss.elastic.co/t/snapshot-api-is-not-working/204702/4 "2019-10-23T14:02:53Z")

</div>

@sandeepkanabar and how can I do the snapshot after creating the repository w/ specifying the index i want?

---

<div class="post-metadata">

**Author:** ![sandeepkanabar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepkanabar/32/79399_2.png) [@sandeepkanabar](https://discuss.elastic.co/u/sandeepkanabar)\
**Post date:** [October 23, 2019, 5:15pm UTC](https://discuss.elastic.co/t/snapshot-api-is-not-working/204702/5 "2019-10-23T17:15:27Z")

</div>

Have a look at the [snapshot documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/modules-snapshots.html#snapshots-take-snapshot) that clearly states how to snapshot a specific index

You have created a repository named `backup` . So use the same when creating snapshots.

```
PUT /_snapshot/backup/my_snapshot?wait_for_completion=true
{
  "indices": "your_index_1,your_index_2",
  "ignore_unavailable": true,
  "include_global_state": false
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 20, 2019, 5:15pm UTC](https://discuss.elastic.co/t/snapshot-api-is-not-working/204702/6 "2019-11-20T17:15:28Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
