Skip to content

Commit

Permalink
added core msearch template tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tokesh <[email protected]>
  • Loading branch information
Tokesh committed Dec 16, 2024
1 parent 54cd734 commit 9d4b1b8
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/default/_core/msearch_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test _termvectors and _msearch/template APIs.
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: 1960}
- {create: {_index: books, _id: book2}}
- {author: Elizabeth Rudnick, title: Beauty and the Beast, year: 1991}
- {create: {_index: books, _id: book3}}
- {author: George Orwell, title: '1984', year: 1949}
epilogues:
- path: /books
method: DELETE
status: [200, 404]

chapters:
- synopsis: Perform a multi-search template query using a GET request.
path: /_msearch/template
method: GET
request:
content_type: application/x-ndjson
payload:
- {index: books}
- {source: '{"query": {"match": {"title": "{{title}}"}}}', params: {title: Mockingbird}}
- {index: books}
- {source: '{"query": {"match": {"title": "{{title}}"}}}', params: {title: Beast}}
response:
status: 200
- synopsis: Perform a multi-search template query using a POST request.
path: /_msearch/template
method: POST
request:
content_type: application/x-ndjson
payload:
- {index: books}
- {source: '{"query": {"match": {"title": "{{title}}"}}}', params: {title: '1984'}}
- {index: books}
- {source: '{"query": {"match": {"author": "{{author}}"}}}', params: {author: Harper Lee}}
response:
status: 200

0 comments on commit 9d4b1b8

Please sign in to comment.