Skip to content
5 changes: 5 additions & 0 deletions docs/changelog/139272.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 139272
summary: ES|QL - Add TOP_SNIPPETS as tech preview
area: ES|QL
type: enhancement
issues: []
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
* [`DECAY`](../../functions-operators/search-functions.md#esql-decay) {applies_to}`stack: preview` {applies_to}`serverless: preview`
* [`KQL`](../../functions-operators/search-functions.md#esql-kql)
* [`MATCH`](../../functions-operators/search-functions.md#esql-match)
* [`MATCH_PHRASE`](../../functions-operators/search-functions.md#esql-match_phrase)
* [`QSTR`](../../functions-operators/search-functions.md#esql-qstr)
% * [`DECAY`](../../functions-operators/search-functions.md#esql-decay) {applies_to}`stack: preview` {applies_to}`serverless: preview`
* [`SCORE`](../../functions-operators/search-functions.md#esql-score) {applies_to}`stack: preview` {applies_to}`serverless: preview`
% * [`TERM`](../../functions-operators/search-functions.md#esql-term) {applies_to}`stack: preview` {applies_to}`serverless: preview`
* [`TOP_SNIPPETS`](../../functions-operators/search-functions.md#esql-top_snippets) {applies_to}`stack: preview` {applies_to}`serverless: preview`
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ for information on the limitations of full text search.
:::{include} ../_snippets/lists/search-functions.md
:::

:::{include} ../_snippets/functions/layout/decay.md
:::

:::{include} ../_snippets/functions/layout/kql.md
:::
Expand All @@ -56,7 +58,7 @@ for information on the limitations of full text search.
:::{include} ../_snippets/functions/layout/score.md
:::

:::{include} ../_snippets/functions/layout/decay.md
:::{include} ../_snippets/functions/layout/top_snippets.md
:::

% TERM is currently a hidden feature
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ public enum Cap {
/**
* Returns the top snippets for given text content and associated query.
*/
TOP_SNIPPETS_FUNCTION(Build.current().isSnapshot()),
TOP_SNIPPETS_FUNCTION,

// Last capability should still have a comma for fewer merge conflicts when adding new ones :)
// This comment prevents the semicolon from being on the previous capability when Spotless formats the file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ private static FunctionDefinition[][] functions() {
def(MvZip.class, MvZip::new, "mv_zip"),
def(MvSum.class, MvSum::new, "mv_sum"),
def(Split.class, Split::new, "split") },
// fulltext functions
// search functions
new FunctionDefinition[] {
def(Decay.class, quad(Decay::new), "decay"),
def(Kql.class, bic(Kql::new), "kql"),
Expand All @@ -536,7 +536,8 @@ private static FunctionDefinition[][] functions() {
def(MultiMatch.class, MultiMatch::new, "multi_match"),
def(QueryString.class, bic(QueryString::new), "qstr"),
def(MatchPhrase.class, tri(MatchPhrase::new), "match_phrase"),
def(Score.class, uni(Score::new), "score") },
def(Score.class, uni(Score::new), "score"),
def(TopSnippets.class, tri(TopSnippets::new), "top_snippets") },
// time-series functions
new FunctionDefinition[] {
defTS3(Rate.class, Rate::new, "rate"),
Expand Down Expand Up @@ -578,8 +579,7 @@ private static FunctionDefinition[][] snapshotFunctions() {
def(L1Norm.class, L1Norm::new, "v_l1_norm"),
def(L2Norm.class, L2Norm::new, "v_l2_norm"),
def(Magnitude.class, Magnitude::new, "v_magnitude"),
def(Hamming.class, Hamming::new, "v_hamming"),
def(TopSnippets.class, tri(TopSnippets::new), "top_snippets") } };
def(Hamming.class, Hamming::new, "v_hamming") } };
}

public EsqlFunctionRegistry snapshotRegistry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3335,8 +3335,6 @@ public void testChunkFunctionInvalidInputs() {
}

public void testTopSnippetsFunctionInvalidInputs() {
assumeTrue("Requires top snippet function", EsqlCapabilities.Cap.TOP_SNIPPETS_FUNCTION.isEnabled());

// Null field allowed
query("from test | EVAL snippets = TOP_SNIPPETS(null, \"query\")");

Expand Down
Loading