forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check preTags and postTags params for empty values (elastic#106396)
Check highlighter params of pre_tags and post_tags params for empty values. If empty throw IllegalArgumentException. Closes elastic#69009
- Loading branch information
Showing
4 changed files
with
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pr: 106396 | ||
summary: "Check preTags and postTags params for empty values" | ||
area: Highlighting | ||
type: bug | ||
issues: | ||
- 69009 |
72 changes: 72 additions & 0 deletions
72
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.highlight/issue69009.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,72 @@ | ||
setup: | ||
- skip: | ||
version: ' - 8.13.99' | ||
reason: 'check of preTags and postTags params for empty values was added in 8.14' | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
mappings: | ||
"properties": | ||
"text": | ||
"type": "text" | ||
"term_vector": "with_positions_offsets" | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: "1" | ||
body: | ||
"text" : "The quick brown fox is brown." | ||
- do: | ||
indices.refresh: {} | ||
|
||
--- | ||
"Test with empty pre_tags or post_tags in query body with unified highlight type - should fail" : | ||
- do: | ||
catch: /pre_tags or post_tags must not be empty/ | ||
search: | ||
index: test | ||
body: { | ||
"query": { "match": { "fox" } }, | ||
"highlight": { | ||
"type": "unified", | ||
"fields": { "*": { } }, | ||
"pre_tags": [ ], | ||
"post_tags": [ ] | ||
}, | ||
} | ||
|
||
--- | ||
"Test with empty pre_tags or post_tags in query body with plain highlight type - should fail" : | ||
- do: | ||
catch: /pre_tags or post_tags must not be empty/ | ||
search: | ||
index: test | ||
body: { | ||
"query": { "match": { "fox" } }, | ||
"highlight": { | ||
"type": "plain", | ||
"fields": { "*": { } }, | ||
"pre_tags": [ ], | ||
"post_tags": [ ] | ||
}, | ||
} | ||
|
||
--- | ||
"Test with empty pre_tags or post_tags in query body with fvh highlight type - should fail" : | ||
- do: | ||
catch: /pre_tags or post_tags must not be empty/ | ||
search: | ||
index: test | ||
body: { | ||
"query": { "match": { "fox" } }, | ||
"highlight": { | ||
"type": "fvh", | ||
"fields": { "*": { } }, | ||
"pre_tags": [ ], | ||
"post_tags": [ ] | ||
}, | ||
} | ||
|
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