Skip to content

Commit 6d8eb0b

Browse files
committed
Added more linear YAML tests
1 parent 2dc0b44 commit 6d8eb0b

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/linear/20_linear_retriever_simplified.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,91 @@ setup:
213213
- lt: { hits.hits.1._score: 1.0 }
214214
- match: { hits.hits.2._id: "1" }
215215
- lt: { hits.hits.2._score: 1.0 }
216+
217+
---
218+
"Can query keyword fields":
219+
- do:
220+
headers:
221+
Content-Type: application/json
222+
search:
223+
index: test-index
224+
body:
225+
retriever:
226+
linear:
227+
fields: [ "keyword" ]
228+
query: "keyword match 1"
229+
normalizer: "minmax"
230+
231+
# Lexical-only match, so max score is 1
232+
- match: { hits.total.value: 1 }
233+
- length: { hits.hits: 1 }
234+
- match: { hits.hits.0._id: "1" }
235+
- close_to: { hits.hits.0._score: { value: 1.0, error: 0.0001 } }
236+
237+
---
238+
"Can query date fields":
239+
- do:
240+
headers:
241+
Content-Type: application/json
242+
search:
243+
index: test-index
244+
body:
245+
retriever:
246+
linear:
247+
fields: [ "timestamp" ]
248+
query: "2010-02-08"
249+
normalizer: "minmax"
250+
251+
# Lexical-only match, so max score is 1
252+
- match: { hits.total.value: 1 }
253+
- length: { hits.hits: 1 }
254+
- match: { hits.hits.0._id: "2" }
255+
- close_to: { hits.hits.0._score: { value: 1.0, error: 0.0001 } }
256+
257+
---
258+
"Wildcard index patterns that do not resolve to any index are handled gracefully":
259+
- do:
260+
search:
261+
index: wildcard-*
262+
body:
263+
retriever:
264+
linear:
265+
query: "match"
266+
normalizer: "minmax"
267+
268+
- match: { hits.total.value: 0 }
269+
- length: { hits.hits: 0 }
270+
271+
---
272+
"Multi-index searches are not allowed":
273+
- do:
274+
indices.create:
275+
index: test-index-2
276+
277+
- do:
278+
catch: bad_request
279+
search:
280+
index: [ test-index, test-index-2 ]
281+
body:
282+
retriever:
283+
linear:
284+
query: "match"
285+
normalizer: "minmax"
286+
287+
- match: { error.root_cause.0.reason: "[linear] does not support the simplified query format when querying multiple indices" }
288+
289+
---
290+
"Wildcard field patterns that do not resolve to any field are handled gracefully":
291+
- do:
292+
search:
293+
index: test-index
294+
body:
295+
retriever:
296+
linear:
297+
fields: [ "wildcard-*" ]
298+
query: "match"
299+
normalizer: "minmax"
300+
301+
- match: { hits.total.value: 0 }
302+
- length: { hits.hits: 0 }
303+

0 commit comments

Comments
 (0)