From 9d4b1b8eb7ecd1cdda25c3bf424b924b8bc535d3 Mon Sep 17 00:00:00 2001 From: Tokesh Date: Mon, 16 Dec 2024 17:30:54 +0500 Subject: [PATCH] added core msearch template tests Signed-off-by: Tokesh --- tests/default/_core/msearch_template.yaml | 47 +++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/default/_core/msearch_template.yaml diff --git a/tests/default/_core/msearch_template.yaml b/tests/default/_core/msearch_template.yaml new file mode 100644 index 00000000..31ca732f --- /dev/null +++ b/tests/default/_core/msearch_template.yaml @@ -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 \ No newline at end of file