Skip to content

Commit 31f11c3

Browse files
authored
[ES|QL] Enable KQL function as a tech preview (#119730)
1 parent da42d77 commit 31f11c3

File tree

17 files changed

+20
-76
lines changed

17 files changed

+20
-76
lines changed

docs/changelog/119730.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 119730
2+
summary: Enable KQL function as a tech preview
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/reference/esql/esql-limitations.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ FROM books
150150

151151
Note that, because of <<esql-limitations-text-fields,the way {esql} treats `text` values>>,
152152
any queries on `text` fields that do not explicitly use the full-text functions,
153-
<<esql-match>> or <<esql-qstr>>, will behave as if the fields are actually `keyword` fields:
153+
<<esql-match>>, <<esql-qstr>> or <<esql-kql>>, will behave as if the fields are actually `keyword` fields:
154154
they are case-sensitive and need to match the full string.
155155

156156
[discrete]

docs/reference/esql/functions/kibana/definition/kql.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/search-functions.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ See <<esql-limitations-full-text-search,full text search limitations>> for infor
1818
{esql} supports these full-text search functions:
1919

2020
// tag::search_list[]
21+
* experimental:[] <<esql-kql>>
2122
* experimental:[] <<esql-match>>
2223
* experimental:[] <<esql-qstr>>
2324
// end::search_list[]
2425

26+
include::layout/kql.asciidoc[]
2527
include::layout/match.asciidoc[]
2628
include::layout/qstr.asciidoc[]

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ static TransportVersion def(int id) {
155155
public static final TransportVersion TRACK_INDEX_FAILED_DUE_TO_VERSION_CONFLICT_METRIC = def(8_820_00_0);
156156
public static final TransportVersion REPLACE_FAILURE_STORE_OPTIONS_WITH_SELECTOR_SYNTAX = def(8_821_00_0);
157157
public static final TransportVersion ELASTIC_INFERENCE_SERVICE_UNIFIED_CHAT_COMPLETIONS_INTEGRATION = def(8_822_00_0);
158+
public static final TransportVersion KQL_QUERY_TECH_PREVIEW = def(8_823_00_0);
158159

159160
/*
160161
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/rest/action/search/SearchCapabilities.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
package org.elasticsearch.rest.action.search;
1111

12-
import org.elasticsearch.Build;
13-
1412
import java.util.HashSet;
1513
import java.util.Set;
1614

@@ -60,9 +58,7 @@ private SearchCapabilities() {}
6058
capabilities.add(KNN_QUANTIZED_VECTOR_RESCORE);
6159
capabilities.add(MOVING_FN_RIGHT_MATH);
6260
capabilities.add(K_DEFAULT_TO_SIZE);
63-
if (Build.current().isSnapshot()) {
64-
capabilities.add(KQL_QUERY_SUPPORTED);
65-
}
61+
capabilities.add(KQL_QUERY_SUPPORTED);
6662
capabilities.add(HIGHLIGHT_MAX_ANALYZED_OFFSET_DEFAULT);
6763
CAPABILITIES = Set.copyOf(capabilities);
6864
}

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
import org.elasticsearch.plugins.Plugin;
1616
import org.elasticsearch.xpack.esql.VerificationException;
1717
import org.elasticsearch.xpack.esql.action.AbstractEsqlIntegTestCase;
18-
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
1918
import org.elasticsearch.xpack.kql.KqlPlugin;
2019
import org.junit.Before;
21-
import org.junit.BeforeClass;
2220

2321
import java.util.Collection;
2422
import java.util.List;
@@ -27,12 +25,6 @@
2725
import static org.hamcrest.CoreMatchers.containsString;
2826

2927
public class KqlFunctionIT extends AbstractEsqlIntegTestCase {
30-
31-
@BeforeClass
32-
protected static void ensureKqlFunctionEnabled() {
33-
assumeTrue("kql function capability not available", EsqlCapabilities.Cap.KQL_FUNCTION.isEnabled());
34-
}
35-
3628
@Before
3729
public void setupIndex() {
3830
createAndPopulateIndex();

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public enum Cap {
452452
/**
453453
* KQL function
454454
*/
455-
KQL_FUNCTION(Build.current().isSnapshot()),
455+
KQL_FUNCTION,
456456

457457
/**
458458
* Hash function

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,10 @@ private static FunctionDefinition[][] functions() {
424424
def(MvSum.class, MvSum::new, "mv_sum"),
425425
def(Split.class, Split::new, "split") },
426426
// fulltext functions
427-
new FunctionDefinition[] { def(Match.class, bi(Match::new), "match"), def(QueryString.class, uni(QueryString::new), "qstr") } };
427+
new FunctionDefinition[] {
428+
def(Kql.class, uni(Kql::new), "kql"),
429+
def(Match.class, bi(Match::new), "match"),
430+
def(QueryString.class, uni(QueryString::new), "qstr") } };
428431

429432
}
430433

@@ -434,7 +437,6 @@ private static FunctionDefinition[][] snapshotFunctions() {
434437
// The delay() function is for debug/snapshot environments only and should never be enabled in a non-snapshot build.
435438
// This is an experimental function and can be removed without notice.
436439
def(Delay.class, Delay::new, "delay"),
437-
def(Kql.class, uni(Kql::new), "kql"),
438440
def(Rate.class, Rate::withUnresolvedTimestamp, "rate"),
439441
def(Term.class, bi(Term::new), "term") } };
440442
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/FullTextWritables.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ public static List<NamedWriteableRegistry.Entry> getNamedWriteables() {
2525
entries.add(MultiMatchQueryPredicate.ENTRY);
2626
entries.add(QueryString.ENTRY);
2727
entries.add(Match.ENTRY);
28+
entries.add(Kql.ENTRY);
2829

29-
if (EsqlCapabilities.Cap.KQL_FUNCTION.isEnabled()) {
30-
entries.add(Kql.ENTRY);
31-
}
3230
if (EsqlCapabilities.Cap.TERM_FUNCTION.isEnabled()) {
3331
entries.add(Term.ENTRY);
3432
}

0 commit comments

Comments
 (0)