Skip to content

Commit

Permalink
Added tests for PUT /_bulk and /{index}/_bulk.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Aug 21, 2024
1 parent f5c4dad commit e306f86
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/default/_core/bulk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ chapters:
payload:
- {create: {_index: movies}}
- {director: Bennett Miller, title: Moneyball, year: 2011}
- synopsis: Delete document in an index.
path: /_bulk
method: PUT
request:
content_type: application/x-ndjson
payload:
- {delete: {_index: movies, _id: invalid}}
response:
status: 200
payload:
errors: false
items:
- delete:
_index: movies
_id: invalid
result: not_found
status: 404
- synopsis: Bulk document CRUD.
path: /_bulk
method: POST
Expand Down
57 changes: 57 additions & 0 deletions tests/default/indices/bulk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test bulk index endpoint.
epilogues:
- path: /books,movies
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create an index.
path: /{index}/_bulk
method: POST
parameters:
index: movies
request:
content_type: application/x-ndjson
payload:
- {create: {}}
- {director: Bennett Miller, title: Moneyball, year: 2011}
- synopsis: Delete document in an index.
path: /{index}/_bulk
method: PUT
parameters:
index: movies
request:
content_type: application/x-ndjson
payload:
- {delete: {_id: invalid}}
response:
status: 200
payload:
errors: false
items:
- delete:
_index: movies
_id: invalid
result: not_found
status: 404
- synopsis: Bulk index document CRUD.
method: POST
path: /{index}/_bulk
parameters:
index: books
request:
content_type: application/x-ndjson
payload:
- {create: {_id: book_1392214}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 1960}
- {update: {_id: book_1392214}}
- {doc: {pages: 376}}
- {update: {_id: book_1392214}}
- {doc: {pages: 376}, _source: true}
- {update: {_id: book_1392214}}
- {script: {source: ctx._source.pages = 376;}}
- {update: {_id: does_not_exist}}
- {script: {source: 'ctx.op = "none";'}, scripted_upsert: true, upsert: {pages: 375}}
- {delete: {_id: book_1392214}}

0 comments on commit e306f86

Please sign in to comment.