Skip to content

Commit be9fa86

Browse files
committed
rrf support old window_size
1 parent 06470b1 commit be9fa86

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

server/src/main/java/org/elasticsearch/search/rank/RankBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*/
4242
public abstract class RankBuilder implements VersionedNamedWriteable, ToXContentObject {
4343

44-
public static final ParseField RANK_WINDOW_SIZE_FIELD = new ParseField("rank_window_size");
44+
public static final ParseField RANK_WINDOW_SIZE_FIELD = new ParseField("rank_window_size", "window_size");
4545

4646
public static final int DEFAULT_RANK_WINDOW_SIZE = SearchService.DEFAULT_SIZE;
4747

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,40 @@ setup:
104104
- match: { hits.hits.2.fields.text.0: "other" }
105105
- match: { hits.hits.2.fields.keyword.0: "other" }
106106

107+
---
108+
"Simple rank with old window_size param":
109+
110+
- requires:
111+
cluster_features: ["gte_v8.16.0"]
112+
reason: "deprecation added in 8.16"
113+
test_runner_features: warnings
114+
115+
- do:
116+
warnings:
117+
- "Deprecated field [rank] used, replaced by [retriever]"
118+
- "Deprecated field [window_size] used, expected [rank_window_size] instead"
119+
search:
120+
index: test
121+
body:
122+
track_total_hits: false
123+
fields: [ "keyword" ]
124+
knn:
125+
field: vector
126+
query_vector: [ 0.0 ]
127+
k: 3
128+
num_candidates: 3
129+
query:
130+
term:
131+
text: term
132+
rank:
133+
rrf:
134+
window_size: 100
135+
rank_constant: 1
136+
size: 1
137+
138+
- match: { hits.hits.0._id: "1" }
139+
- match: { hits.hits.0.fields.keyword.0: "other" }
140+
107141
---
108142
"Simple rank with multiple bm25 sub searches":
109143

0 commit comments

Comments
 (0)