-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Index
Search Template
API tests (#702)
* adding tests for search templates Signed-off-by: Tokesh <[email protected]> * adding changelog log Signed-off-by: Tokesh <[email protected]> * renamed and moved to another more specific folders Signed-off-by: Tokesh <[email protected]> * not correct path to root test story Signed-off-by: Tokesh <[email protected]> --------- Signed-off-by: Tokesh <[email protected]>
- Loading branch information
Showing
4 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
$schema: ../../../../json_schemas/test_story.schema.yaml | ||
|
||
description: Test search with templates using both index-specific and global endpoints via GET and POST methods. | ||
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: Quentin Tarantino, title: Pulp Fiction, year: 1994} | ||
- {create: {_index: movies, _id: movie2}} | ||
- {director: Christopher Nolan, title: Inception, year: 2010} | ||
- path: /_scripts/movie_template | ||
method: POST | ||
request: | ||
content_type: application/json | ||
payload: | ||
script: | ||
lang: mustache | ||
source: > | ||
{ | ||
"query": { | ||
"match": { | ||
"{{field}}": "{{value}}" | ||
} | ||
} | ||
} | ||
chapters: | ||
- synopsis: Perform a search using a template with GET (index-specific). | ||
path: /{index}/_search/template | ||
method: GET | ||
parameters: | ||
index: [movies] | ||
request: | ||
payload: | ||
id: movie_template | ||
params: | ||
field: | ||
value: director | ||
value: | ||
value: Quentin Tarantino | ||
response: | ||
status: 200 | ||
|
||
- synopsis: Perform a search using a template with POST (index-specific). | ||
path: /{index}/_search/template | ||
method: POST | ||
parameters: | ||
index: [movies] | ||
request: | ||
payload: | ||
id: movie_template | ||
params: | ||
field: | ||
value: title | ||
value: | ||
value: Inception | ||
response: | ||
status: 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
$schema: ../../../json_schemas/test_story.schema.yaml | ||
|
||
description: Test search with templates using both index-specific and global endpoints via GET and POST methods. | ||
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: Quentin Tarantino, title: Pulp Fiction, year: 1994} | ||
- {create: {_index: movies, _id: movie2}} | ||
- {director: Christopher Nolan, title: Inception, year: 2010} | ||
- path: /_scripts/movie_template | ||
method: POST | ||
request: | ||
content_type: application/json | ||
payload: | ||
script: | ||
lang: mustache | ||
source: > | ||
{ | ||
"query": { | ||
"match": { | ||
"{{field}}": "{{value}}" | ||
} | ||
} | ||
} | ||
chapters: | ||
- synopsis: Perform a global search using a template with GET. | ||
path: /_search/template | ||
method: GET | ||
request: | ||
payload: | ||
id: movie_template | ||
params: | ||
field: | ||
value: year | ||
value: | ||
value: 1994 | ||
response: | ||
status: 200 | ||
|
||
- synopsis: Perform a global search using a template with POST. | ||
path: /_search/template | ||
method: POST | ||
request: | ||
payload: | ||
id: movie_template | ||
params: | ||
field: | ||
value: year | ||
value: | ||
value: 2010 | ||
response: | ||
status: 200 |