-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Prudhvi Godithi <[email protected]>
- Loading branch information
1 parent
30f1846
commit ad3a608
Showing
4 changed files
with
257 additions
and
6 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,150 @@ | ||
$schema: ../../../../../json_schemas/test_story.schema.yaml | ||
|
||
description: Comprehensive test suite for TermsQuery, including array of terms and term lookup. | ||
version: '>= 1.2' | ||
|
||
prologues: | ||
# Setup for movies index with all necessary fields | ||
- path: /movies | ||
method: PUT | ||
request: | ||
payload: | ||
mappings: | ||
properties: | ||
title: | ||
type: text | ||
genre: | ||
type: keyword | ||
director_id: | ||
type: keyword | ||
status: [200] | ||
|
||
- path: /movies/_doc | ||
method: POST | ||
parameters: | ||
refresh: true | ||
request: | ||
payload: | ||
title: The Lion King | ||
genre: Animation | ||
status: [201] | ||
|
||
- path: /movies/_doc | ||
method: POST | ||
parameters: | ||
refresh: true | ||
request: | ||
payload: | ||
title: Beauty and the Beast | ||
genre: Adventure | ||
status: [201] | ||
|
||
# Setup for games index with all necessary fields | ||
- path: /games | ||
method: PUT | ||
request: | ||
payload: | ||
mappings: | ||
properties: | ||
title: | ||
type: text | ||
genre: | ||
type: keyword | ||
developer_id: | ||
type: keyword | ||
status: [200] | ||
|
||
- path: /games/_doc | ||
method: POST | ||
parameters: | ||
refresh: true | ||
request: | ||
payload: | ||
title: The Witcher 3 | ||
genre: RPG | ||
status: [201] | ||
|
||
- path: /games/_doc | ||
method: POST | ||
parameters: | ||
refresh: true | ||
request: | ||
payload: | ||
title: Cyberpunk 2077 | ||
genre: RPG | ||
status: [201] | ||
|
||
epilogues: | ||
- path: /movies | ||
method: DELETE | ||
status: [200, 404] | ||
|
||
- path: /games | ||
method: DELETE | ||
status: [200, 404] | ||
|
||
chapters: | ||
# Test for TermsQuery with an array of terms | ||
- synopsis: Search using TermsQuery with an array of terms. | ||
path: /{index}/_search | ||
parameters: | ||
index: movies | ||
method: GET | ||
request: | ||
payload: | ||
query: | ||
terms: | ||
genre: | ||
- Adventure | ||
- Animation | ||
response: | ||
status: 200 | ||
payload: | ||
timed_out: false | ||
hits: | ||
total: | ||
value: 2 | ||
relation: eq | ||
hits: | ||
- _index: movies | ||
_score: 1 | ||
_source: | ||
title: The Lion King | ||
genre: Animation | ||
- _index: movies | ||
_score: 1 | ||
_source: | ||
title: Beauty and the Beast | ||
genre: Adventure | ||
|
||
# Test for TermsQuery with an array of terms in games index | ||
- synopsis: Search using TermsQuery with an array of terms in the games index. | ||
path: /{index}/_search | ||
parameters: | ||
index: games | ||
method: GET | ||
request: | ||
payload: | ||
query: | ||
terms: | ||
genre: | ||
- RPG | ||
response: | ||
status: 200 | ||
payload: | ||
timed_out: false | ||
hits: | ||
total: | ||
value: 2 | ||
relation: eq | ||
hits: | ||
- _index: games | ||
_score: 1 | ||
_source: | ||
title: The Witcher 3 | ||
genre: RPG | ||
- _index: games | ||
_score: 1 | ||
_source: | ||
title: Cyberpunk 2077 | ||
genre: RPG |
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,86 @@ | ||
$schema: ../../../../../json_schemas/test_story.schema.yaml | ||
|
||
description: Test TermsSetQuery functionality with complex example using movies. | ||
version: '>= 1.2' | ||
|
||
prologues: | ||
- path: /movies | ||
method: PUT | ||
request: | ||
payload: | ||
mappings: | ||
properties: | ||
title: | ||
type: keyword | ||
genres: | ||
type: keyword | ||
min_required_genres: | ||
type: integer | ||
|
||
- path: /movies/_doc/1 | ||
method: POST | ||
parameters: | ||
refresh: true | ||
request: | ||
payload: | ||
title: The Lion King | ||
genres: [Animation, Adventure, Family] | ||
min_required_genres: 2 | ||
status: [201] | ||
|
||
- path: /movies/_doc/2 | ||
method: POST | ||
parameters: | ||
refresh: true | ||
request: | ||
payload: | ||
title: Beauty and the Beast | ||
genres: [Animation, Musical, Family] | ||
min_required_genres: 2 | ||
status: [201] | ||
|
||
epilogues: | ||
- path: /movies | ||
method: DELETE | ||
status: [200, 404] | ||
|
||
chapters: | ||
- synopsis: Search using TermsSetQuery with terms array and minimum_should_match_field. | ||
path: /{index}/_search | ||
parameters: | ||
index: movies | ||
method: POST | ||
request: | ||
payload: | ||
query: | ||
terms_set: | ||
genres: | ||
terms: [Animation, Adventure, Family] | ||
minimum_should_match_field: min_required_genres | ||
response: | ||
status: 200 | ||
payload: | ||
timed_out: false | ||
hits: | ||
total: | ||
value: 2 | ||
relation: eq | ||
hits: | ||
- _index: movies | ||
_score: 1.4544616 | ||
_source: | ||
title: The Lion King | ||
genres: | ||
- Animation | ||
- Adventure | ||
- Family | ||
min_required_genres: 2 | ||
- _index: movies | ||
_score: 0.5013843 | ||
_source: | ||
title: Beauty and the Beast | ||
genres: | ||
- Animation | ||
- Musical | ||
- Family | ||
min_required_genres: 2 |