Skip to content

Commit 6ff618d

Browse files
committed
rrf support old window_size
(cherry picked from commit be9fa86)
1 parent 5de3d08 commit 6ff618d

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
@@ -35,7 +35,7 @@
3535
*/
3636
public abstract class RankBuilder implements VersionedNamedWriteable, ToXContentObject {
3737

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

4040
public static final int DEFAULT_RANK_WINDOW_SIZE = SearchService.DEFAULT_SIZE;
4141

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
@@ -100,6 +100,40 @@ setup:
100100
- match: { hits.hits.2.fields.text.0: "other" }
101101
- match: { hits.hits.2.fields.keyword.0: "other" }
102102

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

0 commit comments

Comments
 (0)