diff --git a/CHANGELOG.md b/CHANGELOG.md index 13a7e05fb..eeeae2b11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -177,6 +177,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed mapping and analysis types ([#600](https://github.com/opensearch-project/opensearch-api-specification/pull/600)) - Fixed `RestStatus` responses in `DELETE /_plugins/_notifications/configs/{config_id}` ([#594](https://github.com/opensearch-project/opensearch-api-specification/pull/594)) - Fixed `GET /_snapshot_/{repository}/{snapshot}` ([#608](https://github.com/opensearch-project/opensearch-api-specification/pull/608)) +- Fixed `POST /_snapshot/{repository}/{snapshot}/_restore` when `wait_for_completion` is `false` and `GET /{index}/_recovery` ([#611](https://github.com/opensearch-project/opensearch-api-specification/pull/611)) ### Security diff --git a/spec/namespaces/snapshot.yaml b/spec/namespaces/snapshot.yaml index 58ad5f82e..d81a5b173 100644 --- a/spec/namespaces/snapshot.yaml +++ b/spec/namespaces/snapshot.yaml @@ -383,7 +383,7 @@ components: type: object properties: accepted: - description: Equals `true` if the snapshot was accepted. Present when the request had `wait_for_completion` set to `false` + description: Returns `true` if the snapshot was accepted. Present when the request had `wait_for_completion` set to `false`. type: boolean snapshot: $ref: '../schemas/snapshot._common.yaml#/components/schemas/SnapshotInfo' @@ -427,10 +427,11 @@ components: schema: type: object properties: + accepted: + description: Returns `true` if the restore was accepted. Present when the request had `wait_for_completion` set to `false`. + type: boolean snapshot: $ref: '../schemas/snapshot.restore.yaml#/components/schemas/SnapshotRestore' - required: - - snapshot snapshot.status@200: content: application/json: diff --git a/spec/schemas/indices.recovery.yaml b/spec/schemas/indices.recovery.yaml index d2b781830..17019bfad 100644 --- a/spec/schemas/indices.recovery.yaml +++ b/spec/schemas/indices.recovery.yaml @@ -175,6 +175,14 @@ components: $ref: '_common.yaml#/components/schemas/Uuid' index: $ref: '_common.yaml#/components/schemas/IndexName' + isSearchableSnapshot: + type: boolean + remoteStoreIndexShallowCopy: + type: boolean + sourceRemoteStoreRepository: + type: ['null', string] + sourceRemoteTranslogRepository: + type: ['null', string] RecoveryStartStatus: type: object properties: diff --git a/tests/snapshot/snapshot/restore.yaml b/tests/snapshot/snapshot/restore.yaml new file mode 100644 index 000000000..970a39f00 --- /dev/null +++ b/tests/snapshot/snapshot/restore.yaml @@ -0,0 +1,101 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test _snapshot/{repository}/{snapshot}/_restore endpoints. +epilogues: + - path: /_snapshot/{repository}/{snapshot} + method: DELETE + status: [200, 404] + parameters: + repository: my-fs-repository + snapshot: my-test-snapshot + - path: /_snapshot/{repository} + method: DELETE + status: [200, 404] + parameters: + repository: my-fs-repository + - path: /movies + method: DELETE + status: [200, 404] + - path: /books + method: DELETE + status: [200, 404] +prologues: + - path: /_snapshot/{repository} + method: PUT + parameters: + repository: my-fs-repository + request: + payload: + type: fs + settings: + location: /tmp/opensearch/repo + - path: /movies + method: PUT + - path: /books + method: PUT + - path: /_snapshot/{repository}/{snapshot} + method: PUT + parameters: + repository: my-fs-repository + snapshot: my-test-snapshot + wait_for_completion: true + request: + payload: + indices: + - books + - movies + ignore_unavailable: true + include_global_state: false + partial: true + - path: /movies + method: DELETE + status: [200, 404] + - path: /books + method: DELETE + status: [200, 404] +chapters: + - synopsis: Restore snapshot with wait_for_completion true. + path: /_snapshot/{repository}/{snapshot}/_restore + method: POST + parameters: + repository: my-fs-repository + snapshot: my-test-snapshot + wait_for_completion: true + request: + payload: + indices: movies + response: + status: 200 + payload: + snapshot: + snapshot: my-test-snapshot + - synopsis: Restore snapshot with wait_for_completion false. + path: /_snapshot/{repository}/{snapshot}/_restore + method: POST + parameters: + repository: my-fs-repository + snapshot: my-test-snapshot + wait_for_completion: false + request: + payload: + indices: books + response: + status: 200 + payload: + accepted: true + - synopsis: Wait finish async restore. + path: /{index}/_recovery + warnings: + multiple-paths-detected: false + method: GET + parameters: + index: books + response: + status: 200 + payload: + books: + shards: + - stage: DONE + type: SNAPSHOT + retry: + count: 3 \ No newline at end of file