diff --git a/CHANGELOG.md b/CHANGELOG.md index 5edd85dcf..db063efce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `_common.mapping:FlatObjectProperty` ([#661](https://github.com/opensearch-project/opensearch-api-specification/pull/661)) - Added `HEAD /{index}/_doc/{id}` returning `404` ([#670](https://github.com/opensearch-project/opensearch-api-specification/pull/670)) - Added `_common.mapping:IcuCollationKeywordProperty` ([#666](https://github.com/opensearch-project/opensearch-api-specification/pull/666)) +- Added `GET` and `HEAD /{index}/_source/{id}` returning `404` ([#](https://github.com/opensearch-project/opensearch-api-specification/pull/)) ### Removed - Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652)) diff --git a/spec/namespaces/_core.yaml b/spec/namespaces/_core.yaml index 542d55bf2..a6550f87a 100644 --- a/spec/namespaces/_core.yaml +++ b/spec/namespaces/_core.yaml @@ -2047,6 +2047,8 @@ paths: responses: '200': $ref: '#/components/responses/get_source@200' + '404': + $ref: '#/components/responses/get_source@404' head: operationId: exists_source.0 x-operation-group: exists_source @@ -2069,6 +2071,8 @@ paths: responses: '200': $ref: '#/components/responses/exists_source@200' + '404': + $ref: '#/components/responses/exists_source@404' /{index}/_termvectors: get: operationId: termvectors.0 @@ -2913,6 +2917,9 @@ components: exists_source@200: content: application/json: {} + exists_source@404: + content: + application/json: {} explain@200: content: application/json: @@ -3019,6 +3026,11 @@ components: application/json: schema: type: object + get_source@404: + content: + application/json: + schema: + $ref: '../schemas/query._common.yaml#/components/schemas/ErrorResponse' index@200: content: application/json: diff --git a/tests/default/indices/source.yaml b/tests/default/indices/source.yaml new file mode 100644 index 000000000..4d7c234c2 --- /dev/null +++ b/tests/default/indices/source.yaml @@ -0,0 +1,52 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test retrieving a document source. +epilogues: + - path: /movies + method: DELETE + status: [200, 404] +prologues: + - path: /movies/_doc/1 + method: POST + parameters: + refresh: true + request: + payload: + title: Beauty and the Beast + year: 1991 +chapters: + - synopsis: Retrieve the document source. + path: /{index}/_source/{id} + method: GET + parameters: + index: movies + id: '1' + response: + status: 200 + payload: + title: Beauty and the Beast + year: 1991 + - synopsis: Retrieve a non-existent document source. + path: /{index}/_source/{id} + method: GET + parameters: + index: movies + id: '2' + response: + status: 404 + - synopsis: Check whether the document exists. + path: /{index}/_source/{id} + method: HEAD + parameters: + index: movies + id: '1' + response: + status: 200 + - synopsis: Check whether the document exists. + path: /{index}/_source/{id} + method: HEAD + parameters: + index: movies + id: '2' + response: + status: 404