Skip to content

Commit 909d90f

Browse files
Restore test with zero
1 parent dc54b64 commit 909d90f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search.highlight/30_max_analyzed_offset.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,28 @@ setup:
114114
body: {"query" : {"match" : {"field2" : "fox"}}, "highlight" : {"type" : "plain", "fields" : {"field2" : {}}, "max_analyzed_offset": 20}}
115115
- match: {hits.hits.0.highlight.field2.0: "The quick brown <em>fox</em> went to the forest and saw another fox."}
116116

117+
---
118+
"Plain highlighter on a field WITH OFFSETS exceeding index.highlight.max_analyzed_offset with max_analyzed_offset=0 should FAIL":
119+
120+
- requires:
121+
test_runner_features: [capabilities]
122+
capabilities:
123+
- method: GET
124+
path: /_search
125+
capabilities: [ highlight_max_analyzed_offset_default ]
126+
reason: Behavior of max_analyzed_offset query param changed in 8.18.
127+
128+
- do:
129+
catch: bad_request
130+
search:
131+
rest_total_hits_as_int: true
132+
index: test1
133+
body: {"query" : {"match" : {"field2" : "fox"}}, "highlight" : {"type" : "plain", "fields" : {"field2" : {}}, "max_analyzed_offset": 0}}
134+
- match: { status: 400 }
135+
- match: { error.root_cause.0.type: "x_content_parse_exception" }
136+
- match: { error.caused_by.type: "illegal_argument_exception" }
137+
- match: { error.caused_by.reason: "[max_analyzed_offset] must be a positive integer, or -1" }
138+
117139
---
118140
"Plain highlighter on a field WITH OFFSETS exceeding index.highlight.max_analyzed_offset with max_analyzed_offset=1 should SUCCEED":
119141

0 commit comments

Comments
 (0)