Skip to content

Commit

Permalink
Added tests for /{index}/_delete_by_query.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Sep 3, 2024
1 parent d199dd7 commit 23b002c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
55 changes: 55 additions & 0 deletions tests/default/indices/delete_by_query.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test deleting documents that match a query.
epilogues:
- path: /books
method: DELETE
status: [200, 404]
prologues:
- path: /_bulk
method: POST
parameters:
refresh: true
request:
content_type: application/x-ndjson
payload:
- {create: {_index: books, _id: book_1392214}}
- {author: Harper Lee, title: To Kill a Mockingbird, year: 60}
- {create: {_index: books, _id: book_1392215}}
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 91}
chapters:
- synopsis: Delete documents in the index (full query term, script).
path: /{index}/_delete_by_query
method: POST
parameters:
index: books
request:
payload:
query:
term:
title:
_name: title
value: beauty
case_insensitive: true
boost: 1
response:
status: 200
payload:
total: 1
deleted: 1
- synopsis: Delete remaining documents in the index.
path: /{index}/_delete_by_query
method: POST
parameters:
index: books
refresh: true
conflicts: proceed
request:
payload:
query:
match_all: {}
response:
status: 200
payload:
total: 2
deleted: 1
2 changes: 1 addition & 1 deletion tests/default/indices/update_by_query.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test reindex.
description: Test updating documents that match a query.
epilogues:
- path: /books
method: DELETE
Expand Down

0 comments on commit 23b002c

Please sign in to comment.