Skip to content

Commit

Permalink
Fixed /_search/scroll.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Dec 13, 2024
1 parent ebe0f8a commit caa8b35
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 0 additions & 3 deletions spec/namespaces/_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
107 changes: 107 additions & 0 deletions tests/default/_core/search/scroll.yaml
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit caa8b35

Please sign in to comment.