From caa8b35dc40fc0589e5157319bc50d07c4314cae Mon Sep 17 00:00:00 2001 From: dblock Date: Fri, 13 Dec 2024 15:30:57 -0500 Subject: [PATCH] Fixed /_search/scroll. Signed-off-by: dblock --- CHANGELOG.md | 1 + spec/namespaces/_core.yaml | 3 - tests/default/_core/search/scroll.yaml | 107 +++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 tests/default/_core/search/scroll.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b87969f0..d0d48c62e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed response schema for `/_render/template` and `/_render/template/{id}` ([#724](https://github.com/opensearch-project/opensearch-api-specification/pull/724)) - Fixed data stream schema numeric property types ([#725](https://github.com/opensearch-project/opensearch-api-specification/pull/725)) - Fixed snapshot status numeric property types ([#729](https://github.com/opensearch-project/opensearch-api-specification/pull/729)) +- Fixed request body for `/_search/scroll/{scroll_id}` ([#732](https://github.com/opensearch-project/opensearch-api-specification/pull/732)) ### Changed - Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683)) diff --git a/spec/namespaces/_core.yaml b/spec/namespaces/_core.yaml index a1c0e68b0..229fc9e55 100644 --- a/spec/namespaces/_core.yaml +++ b/spec/namespaces/_core.yaml @@ -2523,9 +2523,6 @@ components: $ref: '../schemas/_common.yaml#/components/schemas/Duration' scroll_id: $ref: '../schemas/_common.yaml#/components/schemas/ScrollId' - required: - - scroll_id - description: The scroll ID if not passed by URL or query parameter. search: content: application/json: diff --git a/tests/default/_core/search/scroll.yaml b/tests/default/_core/search/scroll.yaml new file mode 100644 index 000000000..fb4baccd1 --- /dev/null +++ b/tests/default/_core/search/scroll.yaml @@ -0,0 +1,107 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test search scroll. +prologues: + - path: /_bulk + method: POST + parameters: + refresh: true + request: + content_type: application/x-ndjson + payload: + - {create: {_index: movies}} + - {title: The Lion King, year: 1994} + - {create: {_index: movies}} + - {title: Drive, year: 2011} + - {create: {_index: movies}} + - {title: Frozen, year: 2013} + - {create: {_index: movies}} + - {title: Moneyball, year: 2011} + - {create: {_index: movies}} + - {title: The Cruise, year: 1998} + - path: /movies/_search + method: GET + id: scroll + parameters: + scroll: 10m + request: + payload: + query: + match_all: {} + size: 1 + output: + scroll_id: payload._scroll_id +epilogues: + - path: /_search/scroll/_all + method: DELETE + - path: /movies + method: DELETE + status: [200, 404] +chapters: + - synopsis: Get the next batch of results (GET). + method: GET + path: /_search/scroll + request: + payload: + scroll: 10m + scroll_id: ${scroll.scroll_id} + response: + status: 200 + payload: + hits: + hits: + - _index: movies + _source: + title: Drive + - synopsis: Get the next batch of results (POST). + method: POST + path: /_search/scroll + request: + payload: + scroll: 10m + scroll_id: ${scroll.scroll_id} + response: + status: 200 + payload: + hits: + hits: + - _index: movies + _source: + title: Frozen + - synopsis: Get the next batch of results (GET). + method: GET + path: /_search/scroll/{scroll_id} + parameters: + scroll_id: ${scroll.scroll_id} + request: + payload: + scroll: 10m + response: + status: 200 + payload: + hits: + hits: + - _index: movies + _source: + title: Moneyball + - synopsis: Get the next batch of results (POST). + method: POST + path: /_search/scroll/{scroll_id} + parameters: + scroll_id: ${scroll.scroll_id} + request: + payload: + scroll: 10m + response: + status: 200 + payload: + hits: + hits: + - _index: movies + _source: + title: The Cruise + - synopsis: Delete the scroll. + method: DELETE + path: /_search/scroll/{scroll_id} + parameters: + scroll_id: ${scroll.scroll_id}