Skip to content

Commit 4fa8485

Browse files
authored
Ensuring consistent ordering for inner hits in collapse test for rrf (#114740)
1 parent 403f1e1 commit 4fa8485

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,6 @@ tests:
325325
- class: org.elasticsearch.xpack.inference.services.cohere.CohereServiceTests
326326
method: testInfer_StreamRequest_ErrorResponse
327327
issue: https://github.com/elastic/elasticsearch/issues/114327
328-
- class: org.elasticsearch.xpack.rank.rrf.RRFRankClientYamlTestSuiteIT
329-
method: test {yaml=rrf/700_rrf_retriever_search_api_compatibility/rrf retriever with top-level collapse}
330-
issue: https://github.com/elastic/elasticsearch/issues/114331
331328
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
332329
method: test {yaml=cluster.stats/30_ccs_stats/cross-cluster search stats search}
333330
issue: https://github.com/elastic/elasticsearch/issues/114371

x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/700_rrf_retriever_search_api_compatibility.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ setup:
1111
body:
1212
mappings:
1313
properties:
14+
id:
15+
type: integer
1416
text:
1517
type: text
1618
text_to_highlight:
@@ -39,6 +41,7 @@ setup:
3941
index: test
4042
id: "1"
4143
body:
44+
id: 1
4245
text: "term1"
4346
vector: [1.0]
4447

@@ -47,6 +50,7 @@ setup:
4750
index: test
4851
id: "2"
4952
body:
53+
id: 2
5054
text: "term2"
5155
text_to_highlight: "search for the truth"
5256
keyword: "biology"
@@ -57,6 +61,7 @@ setup:
5761
index: test
5862
id: "3"
5963
body:
64+
id: 3
6065
text: "term3"
6166
text_to_highlight: "nothing related"
6267
keyword: "technology"
@@ -67,23 +72,26 @@ setup:
6772
index: test
6873
id: "4"
6974
body:
75+
id: 4
7076
text: "term4"
7177
vector: [4.0]
7278
- do:
7379
index:
7480
index: test
7581
id: "5"
7682
body:
83+
id: 5
7784
text: "term5"
7885
text_to_highlight: "You know, for Search!"
7986
keyword: "technology"
8087
integer: 5
8188
vector: [5.0]
8289
- do:
8390
index:
91+
id: 6
8492
index: test
85-
id: "6"
8693
body:
94+
id: 6
8795
text: "term6"
8896
keyword: "biology"
8997
integer: 6
@@ -93,6 +101,7 @@ setup:
93101
index: test
94102
id: "7"
95103
body:
104+
id: 7
96105
text: "term7"
97106
keyword: "astronomy"
98107
vector: [77.0]
@@ -102,6 +111,7 @@ setup:
102111
index: test
103112
id: "8"
104113
body:
114+
id: 8
105115
text: "term8"
106116
keyword: "technology"
107117
nested: { views: 100}
@@ -110,6 +120,7 @@ setup:
110120
index: test
111121
id: "9"
112122
body:
123+
id: 9
113124
text: "term9"
114125
integer: 2
115126
keyword: "technology"
@@ -439,7 +450,19 @@ setup:
439450
rank_window_size: 5
440451
rank_constant: 10
441452
size: 3
442-
collapse: { field: keyword, inner_hits: { name: sub_hits, size: 2 } }
453+
collapse: {
454+
field: keyword,
455+
inner_hits: {
456+
name: sub_hits,
457+
size: 2,
458+
sort:
459+
{
460+
id: {
461+
order: desc
462+
}
463+
}
464+
}
465+
}
443466

444467
- match: { hits.total : 9 }
445468

@@ -456,8 +479,8 @@ setup:
456479

457480
- match: { hits.hits.1.inner_hits.sub_hits.hits.total : 4 }
458481
- length: { hits.hits.1.inner_hits.sub_hits.hits.hits : 2 }
459-
- match: { hits.hits.1.inner_hits.sub_hits.hits.hits.0._id: "5" }
460-
- match: { hits.hits.1.inner_hits.sub_hits.hits.hits.1._id: "3" }
482+
- match: { hits.hits.1.inner_hits.sub_hits.hits.hits.0._id: "9" }
483+
- match: { hits.hits.1.inner_hits.sub_hits.hits.hits.1._id: "8" }
461484

462485
- length: { hits.hits.2.inner_hits.sub_hits.hits.hits: 2 }
463486
- match: { hits.hits.2.inner_hits.sub_hits.hits.hits.0._id: "6" }

0 commit comments

Comments
 (0)