77
88package org .elasticsearch .xpack .esql .qa .rest ;
99
10- import org .elasticsearch .Build ;
1110import org .elasticsearch .client .Request ;
1211import org .elasticsearch .client .ResponseException ;
1312import org .elasticsearch .test .rest .ESRestTestCase ;
13+ import org .elasticsearch .xpack .esql .action .EsqlCapabilities ;
1414import org .junit .After ;
1515import org .junit .Before ;
1616
2424
2525public class RestRerankTestCase extends ESRestTestCase {
2626
27+ @ Before
28+ public void skipWhenRerankDisabled () throws IOException {
29+ assumeTrue (
30+ "Requires RERANK capability" ,
31+ EsqlSpecTestCase .hasCapabilities (adminClient (), List .of (EsqlCapabilities .Cap .RERANK .capabilityName ()))
32+ );
33+ }
34+
2735 @ Before
2836 @ After
2937 public void assertRequestBreakerEmpty () throws Exception {
@@ -77,8 +85,6 @@ public void wipeData() throws IOException {
7785 }
7886
7987 public void testRerankWithSingleField () throws IOException {
80- assumeTrue ("rerank capability not available" , Build .current ().isSnapshot ());
81-
8288 String query = """
8389 FROM rerank-test-index
8490 | WHERE match(title, "exploration")
@@ -98,8 +104,6 @@ public void testRerankWithSingleField() throws IOException {
98104 }
99105
100106 public void testRerankWithMultipleFields () throws IOException {
101- assumeTrue ("rerank capability not available" , Build .current ().isSnapshot ());
102-
103107 String query = """
104108 FROM rerank-test-index
105109 | WHERE match(title, "exploration")
@@ -119,8 +123,6 @@ public void testRerankWithMultipleFields() throws IOException {
119123 }
120124
121125 public void testRerankWithPositionalParams () throws IOException {
122- assumeTrue ("rerank capability not available" , Build .current ().isSnapshot ());
123-
124126 String query = """
125127 FROM rerank-test-index
126128 | WHERE match(title, "exploration")
@@ -140,8 +142,6 @@ public void testRerankWithPositionalParams() throws IOException {
140142 }
141143
142144 public void testRerankWithNamedParams () throws IOException {
143- assumeTrue ("rerank capability not available" , Build .current ().isSnapshot ());
144-
145145 String query = """
146146 FROM rerank-test-index
147147 | WHERE match(title, ?queryText)
@@ -161,8 +161,6 @@ public void testRerankWithNamedParams() throws IOException {
161161 }
162162
163163 public void testRerankWithMissingInferenceId () {
164- assumeTrue ("rerank capability not available" , Build .current ().isSnapshot ());
165-
166164 String query = """
167165 FROM rerank-test-index
168166 | WHERE match(title, "exploration")
0 commit comments