Skip to content

Commit

Permalink
Fix: specify _source includes/excludes. (#607)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock authored Oct 9, 2024
1 parent 6b63759 commit 67f5221
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spec/schemas/_core.search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ components:
- title: includes
type: array
items:
$ref: '_common.yaml#/components/schemas/Field'
$ref: '_common.yaml#/components/schemas/Field'
- title: filter
$ref: '#/components/schemas/SourceFilter'
SourceFilter:
Expand Down
47 changes: 47 additions & 0 deletions tests/default/_core/mget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test document multi-get.
epilogues:
- path: /books
method: DELETE
status: [200, 404]
- path: /movies
method: DELETE
status: [200, 404]
prologues:
- path: /_bulk
method: POST
parameters:
refresh: true
request:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book1}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 60}
- {create: {_index: movies, _id: movie1}}
- {director: Bennett Miller, title: The Cruise, year: 1998}
- {create: {_index: movies, _id: movie2}}
- {director: Nicolas Winding Refn, title: Drive, year: 1960}
chapters:
- synopsis: Retrieve documents from multiple indexes.
path: /_mget
method: GET
request:
payload:
docs:
- _index: movies
_id: movie1
_source: true
- _index: books
_id: book1
_source:
includes:
- title
response:
status: 200
payload:
docs:
- _index: movies
_id: movie1
- _index: books
_id: book1
48 changes: 48 additions & 0 deletions tests/default/indices/mget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test document multi-get.
epilogues:
- path: /movies
method: DELETE
status: [200, 404]
prologues:
- path: /_bulk
method: POST
parameters:
refresh: true
request:
content_type: application/x-ndjson
payload:
- {create: {_index: movies, _id: movie1}}
- {director: Bennett Miller, title: The Cruise, year: 1998}
- {create: {_index: movies, _id: movie2}}
- {director: Nicolas Winding Refn, title: Drive, year: 1960}
chapters:
- synopsis: Retrieve documents from multiple indexes.
path: /{index}/_mget
method: GET
parameters:
index: movies
request:
payload:
docs:
- _id: movie1
_source:
excludes:
- title
- _id: movie1
_source: false
- _id: movie2
_source:
includes:
- title
response:
status: 200
payload:
docs:
- _index: movies
_id: movie1
- _index: movies
_id: movie1
- _index: movies
_id: movie2

0 comments on commit 67f5221

Please sign in to comment.