forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8242e15
commit 53433f9
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
rest-api-spec/src/main/resources/rest-api-spec/test/search/350_matched_queries.yml
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,53 @@ | ||
--- | ||
"matched queries": | ||
- skip: | ||
version: " - 2.12.0" | ||
reason: "implemented for versions post 2.12.0" | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- '{ "index" : { "_index" : "test_1", "_id" : "1" } }' | ||
- '{"field" : 1 }' | ||
- '{ "index" : { "_index" : "test_1", "_id" : "2" } }' | ||
- '{"field" : [1, 2] }' | ||
|
||
- do: | ||
search: | ||
index: test_1 | ||
body: | ||
query: | ||
bool: { | ||
should: [ | ||
{ | ||
match: { | ||
field: { | ||
query: 1, | ||
_name: match_field_1 | ||
} | ||
} | ||
}, | ||
{ | ||
match: { | ||
field: { | ||
query: 2, | ||
_name: match_field_2, | ||
boost: 10 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
|
||
- match: { hits.total.value: 2 } | ||
- length: { hits.hits.0.matched_queries: 2 } | ||
- match: { hits.hits.0.matched_queries: [ "match_field_1", "match_field_2" ] } | ||
- length: { hits.hits.1.matched_queries: 1 } | ||
- match: { hits.hits.1.matched_queries: [ "match_field_1" ] } | ||
|
||
|