summaryrefslogtreecommitdiff
path: root/rest-api-spec/src
diff options
context:
space:
mode:
authorAli Beyad <ali@elastic.co>2017-05-10 15:48:40 -0400
committerGitHub <noreply@github.com>2017-05-10 15:48:40 -0400
commit743217a4309dbe11a0c6b597cd3eedf5156d78bc (patch)
tree7a6eb59670b3533b6136b415fe93f8d28fd98809 /rest-api-spec/src
parentfbf532a626935b70da005fffdd8e5a14f5e97739 (diff)
Enhances get snapshots API to allow retrieving repository index only (#24477)
Currently, the get snapshots API (e.g. /_snapshot/{repositoryName}/_all) provides information about snapshots in the repository, including the snapshot state, number of shards snapshotted, failures, etc. In order to provide information about each snapshot in the repository, the call must read the snapshot metadata blob (`snap-{snapshot_uuid}.dat`) for every snapshot. In cloud-based repositories, this can be expensive, both from a cost and performance perspective. Sometimes, all the user wants is to retrieve all the names/uuids of each snapshot, and the indices that went into each snapshot, without any of the other status information about the snapshot. This minimal information can be retrieved from the repository index blob (`index-N`) without needing to read each snapshot metadata blob. This commit enhances the get snapshots API with an optional `verbose` parameter. If `verbose` is set to false on the request, then the get snapshots API will only retrieve the minimal information about each snapshot (the name, uuid, and indices in the snapshot), and only read this information from the repository index blob, thereby giving users the option to retrieve the snapshots in a repository in a more cost-effective and efficient manner. Closes #24288
Diffstat (limited to 'rest-api-spec/src')
-rw-r--r--rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.get.json4
-rw-r--r--rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.get/10_basic.yaml41
2 files changed, 45 insertions, 0 deletions
diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.get.json b/rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.get.json
index 760809cdf9..02f5259bc2 100644
--- a/rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.get.json
+++ b/rest-api-spec/src/main/resources/rest-api-spec/api/snapshot.get.json
@@ -25,6 +25,10 @@
"ignore_unavailable": {
"type": "boolean",
"description": "Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown"
+ },
+ "verbose": {
+ "type": "boolean",
+ "description": "Whether to show verbose snapshot info or only show the basic info found in the repository index blob"
}
}
},
diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.get/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.get/10_basic.yaml
index 24a7ac6adc..515662355d 100644
--- a/rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.get/10_basic.yaml
+++ b/rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.get/10_basic.yaml
@@ -33,6 +33,11 @@ setup:
- is_true: snapshots
+ - do:
+ snapshot.delete:
+ repository: test_repo_get_1
+ snapshot: test_snapshot
+
---
"Get missing snapshot info throws an exception":
@@ -52,3 +57,39 @@ setup:
ignore_unavailable: true
- is_true: snapshots
+
+---
+"Get snapshot info when verbose is false":
+ - skip:
+ version: " - 5.99.99"
+ reason: verbose mode was introduced in 6.0
+
+ - do:
+ indices.create:
+ index: test_index
+ body:
+ settings:
+ number_of_shards: 1
+ number_of_replicas: 0
+
+ - do:
+ snapshot.create:
+ repository: test_repo_get_1
+ snapshot: test_snapshot
+ wait_for_completion: true
+
+ - do:
+ snapshot.get:
+ repository: test_repo_get_1
+ snapshot: test_snapshot
+ verbose: false
+
+ - is_true: snapshots
+ - match: { snapshots.0.snapshot: test_snapshot }
+ - match: { snapshots.0.state: SUCCESS }
+ - is_false: snapshots.0.version
+
+ - do:
+ snapshot.delete:
+ repository: test_repo_get_1
+ snapshot: test_snapshot