Create or update snapshot repository API
Registers or updates a snapshot repository.
resp = client.snapshot.create_repository(
name="my_repository",
repository={
"type": "fs",
"settings": {
"location": "my_backup_location"
}
},
)
print(resp) response = client.snapshot.create_repository(
repository: 'my_repository',
body: {
type: 'fs',
settings: {
location: 'my_backup_location'
}
}
)
puts response const response = await client.snapshot.createRepository({
name: "my_repository",
repository: {
type: "fs",
settings: {
location: "my_backup_location",
},
},
});
console.log(response); PUT /_snapshot/my_repository
{
"type": "fs",
"settings": {
"location": "my_backup_location"
}
} If you’re migrating searchable snapshots, the repository’s name must be identical in the source and destination clusters.
Request
PUT /_snapshot/<repository>
POST /_snapshot/<repository>
Prerequisites
- If the Elasticsearch security features are enabled, you must have the
managecluster privilege to use this API.
- To register a snapshot repository, the cluster’s global metadata must be writeable. Ensure there aren’t any cluster blocks that prevent write access.
Path parameters
-
<repository> - (Required, string) Name of the snapshot repository to register or update.
Query parameters
Several options for this API can be specified using a query parameter or a request body parameter. If both parameters are specified, only the query parameter is used.
-
master_timeout - (Optional, time units) 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. Defaults to
30s. Can also be set to-1to indicate that the request should never timeout. -
timeout - (Optional, time units) Period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata. If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged. Defaults to
30s. Can also be set to-1to indicate that the request should never timeout. -
verify -
(Optional, Boolean) If
true, the request verifies the repository is functional on all master and data nodes in the cluster. Iffalse, this verification is skipped. Defaults totrue.You can manually perform this verification using the verify snapshot repository API.
Request body
-
type -
(Required, string) Repository type.
Valid values for
typeOther repository types are available through official plugins:
-
settings -
(Required, object) Settings for the repository. Supported settings vary based on the repository type:
Other repository types are available through official plugins:
-
verify -
(Optional, Boolean) If
true, the request verifies the repository is functional on all master and data nodes in the cluster. Iffalse, this verification is skipped. Defaults totrue.You can manually perform this verification using the verify snapshot repository API.
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/put-snapshot-repo-api.html