Create or update a snapshot repository Added in 0.0.0

PUT /_snapshot/{repository}

IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. To register a snapshot repository, the cluster's global metadata must be writeable. Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access.

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.

External documentation

Path parameters

  • repository string Required

    The name of the snapshot repository to register or update.

Query parameters

  • 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.

  • timeout string

    The 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. To indicate that the request should never timeout, set it to -1.

  • verify boolean

    If true, the request verifies the repository is functional on all master and data nodes in the cluster. If false, this verification is skipped. You can also perform this verification with the verify snapshot repository API.

application/json

Body object Required

One of:
  • uuid string
  • type string Required Discriminator

    The Azure repository type.

    Value is azure.

    External documentation
  • Hide attributes Show attributes object
    • compress boolean

      When set to true, metadata files are stored in compressed format. This setting doesn't affect index files that are already compressed by default.

    • The path to the repository data within the container. It defaults to the root directory.

      NOTE: Don't set base_path when configuring a snapshot repository for Elastic Cloud Enterprise. Elastic Cloud Enterprise automatically generates the base_path for each deployment so that multiple deployments can share the same bucket.

    • client string

      The name of the Azure repository client to use.

    • The Azure container.

    • The maxmimum batch size, between 1 and 256, used for BlobBatch requests. Defaults to 256 which is the maximum number supported by the Azure blob batch API.

    • Either primary_only or secondary_only. Note that if you set it to secondary_only, it will force readonly to true.

    • The maximum number of concurrent batch delete requests that will be submitted for any individual bulk delete with BlobBatch. Note that the effective number of concurrent deletes is further limited by the Azure client connection and event loop thread limits. Defaults to 10, minimum is 1, maximum is 100.

    • readonly boolean

      If true, the repository is read-only. The cluster can retrieve and restore snapshots from the repository but not write to the repository or create snapshots in it.

      Only a cluster with write access can create snapshots in the repository. All other clusters connected to the repository should have the readonly parameter set to true. If false, the cluster can write to the repository and create snapshots in it.

      IMPORTANT: If you register the same snapshot repository with multiple clusters, only one cluster should have write access to the repository. Having multiple clusters write to the repository at the same time risks corrupting the contents of the repository.

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • acknowledged boolean Required

      For a successful response, this value is always true. On failure, an exception is returned instead.

PUT /_snapshot/{repository}
curl \
 --request PUT 'http://api.example.com/_snapshot/{repository}' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '"{\n  \"type\": \"fs\",\n  \"settings\": {\n    \"location\": \"my_backup_location\"\n  }\n}"'
Run `PUT /_snapshot/my_repository` to create or update a shared file system snapshot repository.
{
  "type": "fs",
  "settings": {
    "location": "my_backup_location"
  }
}
Run `PUT /_snapshot/my_repository` to create or update an Azure snapshot repository.
{
  "type": "azure",
  "settings": {
    "client": "secondary"
  }
}
Run `PUT /_snapshot/my_gcs_repository` to create or update a Google Cloud Storage snapshot repository.
{
  "type": "gcs",
  "settings": {
    "bucket": "my_other_bucket",
    "base_path": "dev"
  }
}
Run `PUT /_snapshot/my_s3_repository` to create or update an AWS S3 snapshot repository.
{
  "type": "s3",
  "settings": {
    "bucket": "my-bucket"
  }
}
Run `PUT _snapshot/my_src_only_repository` to create or update a source-only snapshot repository.
{
  "type": "source",
  "settings": {
    "delegate_type": "fs",
    "location": "my_backup_repository"
  }
}
Run `PUT _snapshot/my_read_only_url_repository` to create or update a read-only URL snapshot repository.
{
  "type": "url",
  "settings": {
    "url": "file:/mount/backups/my_fs_backup_location"
  }
}
Response examples (200)
{
  "acknowledged": true
}