-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rolling upgrade test for wildcard field
Signed-off-by: gesong.samuel <[email protected]>
- Loading branch information
gesong.samuel
committed
Feb 15, 2025
1 parent
b3576d9
commit f82a1eb
Showing
3 changed files
with
960 additions
and
0 deletions.
There are no files selected for viewing
307 changes: 307 additions & 0 deletions
307
qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/40_wildcard.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,307 @@ | ||
# refactored from rest-api-spec/src/main/resources/rest-api-spec/test/search/270_wildcard_fieldtype_queries.yml | ||
--- | ||
"search on mixed state": | ||
# "term query matches exact value" | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
term: | ||
my_field: "AbCd" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "5" } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
term: | ||
my_field.doc_values: "AbCd" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "5" } | ||
|
||
# term query matches lowercase-normalized value | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
term: | ||
my_field.lower: "abcd" | ||
- match: { hits.total.value: 2 } | ||
- match: { hits.hits.0._id: "5" } | ||
- match: { hits.hits.1._id: "7" } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
term: | ||
my_field.lower: "ABCD" | ||
- match: { hits.total.value: 2 } | ||
- match: { hits.hits.0._id: "5" } | ||
- match: { hits.hits.1._id: "7" } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
term: | ||
my_field: "abcd" | ||
- match: { hits.total.value: 0 } | ||
|
||
# wildcard query matches | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
wildcard: | ||
my_field: | ||
value: "*Node*Exception*" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "1" } | ||
|
||
# wildcard query matches lowercase-normalized field | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
wildcard: | ||
my_field.lower: | ||
value: "*node*exception*" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "1" } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
wildcard: | ||
my_field.lower: | ||
value: "*NODE*EXCEPTION*" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "1" } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
wildcard: | ||
my_field: | ||
value: "*node*exception*" | ||
- match: { hits.total.value: 0 } | ||
|
||
# prefix query matches | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
prefix: | ||
my_field: | ||
value: "[2024-06-08T" | ||
- match: { hits.total.value: 3 } | ||
|
||
# regexp query matches | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
regexp: | ||
my_field: | ||
value: ".*06-08.*cluster-manager node.*" | ||
- match: { hits.total.value: 2 } | ||
|
||
# regexp query matches lowercase-normalized field | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
regexp: | ||
my_field.lower: | ||
value: ".*06-08.*Cluster-Manager Node.*" | ||
- match: { hits.total.value: 2 } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
regexp: | ||
my_field: | ||
value: ".*06-08.*Cluster-Manager Node.*" | ||
- match: { hits.total.value: 0 } | ||
|
||
# wildcard match-all works | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
wildcard: | ||
my_field: | ||
value: "*" | ||
- match: { hits.total.value: 8 } | ||
|
||
# regexp match-all works | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
regexp: | ||
my_field: | ||
value: ".*" | ||
- match: { hits.total.value: 8 } | ||
|
||
# terms query on wildcard field matches | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
terms: { my_field: [ "AbCd" ] } | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "5" } | ||
|
||
# case insensitive query on wildcard field | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
wildcard: | ||
my_field: | ||
value: "AbCd" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "5" } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
wildcard: | ||
my_field: | ||
value: "AbCd" | ||
case_insensitive: true | ||
- match: { hits.total.value: 2 } | ||
- match: { hits.hits.0._id: "5" } | ||
- match: { hits.hits.1._id: "7" } | ||
|
||
# case insensitive regexp query on wildcard field | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
regexp: | ||
my_field: | ||
value: "AbCd" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "5" } | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
regexp: | ||
my_field: | ||
value: "AbCd" | ||
case_insensitive: true | ||
- match: { hits.total.value: 2 } | ||
- match: { hits.hits.0._id: "5" } | ||
- match: { hits.hits.1._id: "7" } | ||
|
||
# wildcard query works on values contains escaped characters | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
wildcard: | ||
my_field: | ||
value: "\\*" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "8" } | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
wildcard: | ||
my_field: | ||
value: "\\\\\\*" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "9" } | ||
|
||
# regexp query works on values contains escaped characters | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
regexp: | ||
my_field: | ||
value: "\\*" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "8" } | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
regexp: | ||
my_field: | ||
value: "\\\\\\*" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "9" } | ||
|
||
# term query contains escaped characters | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
term: | ||
my_field: "\\*" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "9" } | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
term: | ||
my_field: "*" | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "8"} | ||
|
||
# terms query contains escaped characters | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
terms: { my_field: ["*"] } | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "8" } | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
terms: { my_field: [ "\\*" ] } | ||
- match: { hits.total.value: 1 } | ||
- match: { hits.hits.0._id: "9" } |
Oops, something went wrong.