-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix search_as_you_type not supporting multi-fields (#15988)
* Fix search_as_you_type not supporting multi-fields Signed-off-by: Gao Binlong <[email protected]> * Modify change log Signed-off-by: Gao Binlong <[email protected]> * Fix test failure Signed-off-by: Gao Binlong <[email protected]> * Add more yaml test Signed-off-by: Gao Binlong <[email protected]> --------- Signed-off-by: Gao Binlong <[email protected]>
- Loading branch information
1 parent
b984b9f
commit c85ee68
Showing
5 changed files
with
101 additions
and
2 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
File renamed without changes.
75 changes: 75 additions & 0 deletions
75
rest-api-spec/src/main/resources/rest-api-spec/test/search/390_search_as_you_type.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,75 @@ | ||
setup: | ||
- do: | ||
indices.create: | ||
index: test_1 | ||
body: | ||
mappings: | ||
properties: | ||
text: | ||
type: search_as_you_type | ||
fields: | ||
subField: | ||
type: keyword | ||
- do: | ||
index: | ||
index: test_1 | ||
id: 1 | ||
body: { text: test search as you type } | ||
|
||
- do: | ||
indices.refresh: | ||
index: [test_1] | ||
|
||
--- | ||
teardown: | ||
- do: | ||
indices.delete: | ||
index: test_1 | ||
|
||
# related issue: https://github.com/opensearch-project/OpenSearch/issues/5035 | ||
--- | ||
"Test search_as_you_type data type supports multi-fields": | ||
- skip: | ||
version: " - 2.99.99" | ||
reason: "the bug was fixed since 3.0.0" | ||
|
||
- do: | ||
indices.get_mapping: { | ||
index: test_1 | ||
} | ||
|
||
- match: {test_1.mappings.properties.text.type: search_as_you_type} | ||
- match: {test_1.mappings.properties.text.fields.subField.type: keyword} | ||
|
||
- do: | ||
search: | ||
index: test_1 | ||
body: | ||
query: | ||
multi_match: | ||
query: "test search" | ||
type: "bool_prefix" | ||
|
||
- match: {hits.total.value: 1} | ||
|
||
- do: | ||
search: | ||
index: test_1 | ||
body: | ||
query: | ||
multi_match: | ||
query: "test search" | ||
type: "bool_prefix" | ||
fields: ["text.subField"] | ||
|
||
- match: {hits.total.value: 1} | ||
|
||
- do: | ||
search: | ||
index: test_1 | ||
body: | ||
query: | ||
term: | ||
text.subField: "test search as you type" | ||
|
||
- match: {hits.total.value: 1} |