Skip to content

Commit 25e9d4c

Browse files
committed
only run esql spec IT
1 parent ee51465 commit 25e9d4c

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/score-function.csv-spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ book_no:keyword | author:text | s1:double
109109
matchWithDisjunctionAndFiltersConjunction
110110
required_capability: match_function
111111
required_capability: full_text_functions_disjunctions
112+
required_capability: score_function
112113

113114
from books
114115
| eval s1 = score((match(author, "Vonnegut") or match(author, "Guinane")) and year > 1997)

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/plugin/ScoreFunctionIT.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.elasticsearch.common.settings.Settings;
1313
import org.elasticsearch.common.util.CollectionUtils;
1414
import org.elasticsearch.plugins.Plugin;
15+
import org.elasticsearch.test.junit.annotations.TestLogging;
1516
import org.elasticsearch.xpack.esql.VerificationException;
1617
import org.elasticsearch.xpack.esql.action.AbstractEsqlIntegTestCase;
1718
import org.elasticsearch.xpack.kql.KqlPlugin;
@@ -23,14 +24,33 @@
2324
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
2425
import static org.hamcrest.CoreMatchers.containsString;
2526

26-
//@TestLogging(value = "org.elasticsearch.xpack.esql:TRACE,org.elasticsearch.compute:TRACE", reason = "debug")
27+
@TestLogging(value = "org.elasticsearch.xpack.esql:TRACE,org.elasticsearch.compute:TRACE", reason = "debug")
2728
public class ScoreFunctionIT extends AbstractEsqlIntegTestCase {
2829

2930
@Before
3031
public void setupIndex() {
3132
createAndPopulateIndex();
3233
}
3334

35+
public void testScoreSingleNoMetadata() {
36+
var query = """
37+
FROM test
38+
| WHERE match(content, "fox") AND match(content, "brown")
39+
| EVAL first_score = score(match(content, "fox"))
40+
| KEEP id, first_score
41+
| SORT id
42+
""";
43+
44+
try (var resp = run(query)) {
45+
assertColumnNames(resp.columns(), List.of("id", "first_score"));
46+
assertColumnTypes(resp.columns(), List.of("integer", "double"));
47+
assertValues(
48+
resp.values(),
49+
List.of(List.of(1, 1.156558871269226), List.of(6, 0.9114001989364624))
50+
);
51+
}
52+
}
53+
3454
public void testScoreDifferentWhereMatch() {
3555
var query = """
3656
FROM test METADATA _score

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ public final void test() throws Throwable {
276276
"can't use match in csv tests",
277277
testCase.requiredCapabilities.contains(EsqlCapabilities.Cap.MATCH_OPERATOR_COLON.capabilityName())
278278
);
279+
assumeFalse(
280+
"can't use score function in csv tests",
281+
testCase.requiredCapabilities.contains(EsqlCapabilities.Cap.SCORE_FUNCTION.capabilityName())
282+
);
279283
assumeFalse(
280284
"can't load metrics in csv tests",
281285
testCase.requiredCapabilities.contains(EsqlCapabilities.Cap.METRICS_COMMAND.capabilityName())

0 commit comments

Comments
 (0)