Snapshot api is not working

I have the following code:

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!

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

Could you try without

?wait_for_completion=true

The command that you are trying is for creating repository. As @dadoonet said, remove ?wait_for_completion=true and also remove "indices": "index_1". You specify indices when actually doing the snapshot not while creating repository.

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

Have a look at the snapshot documentation 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
}

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