Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/116819.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 116819
summary: ESQL - Add match operator (:)
area: Search
type: feature
issues: []

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

14 changes: 14 additions & 0 deletions docs/reference/esql/functions/kibana/docs/match_operator.md

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

2 changes: 2 additions & 0 deletions docs/reference/esql/functions/operators.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Boolean operators for comparing against one or multiple expressions.
* <<esql-in-operator>>
* <<esql-like-operator>>
* <<esql-rlike-operator>>
* experimental:[] <<esql-search-operators>>
// end::op_list[]

include::binary.asciidoc[]
Expand All @@ -26,3 +27,4 @@ include::cast.asciidoc[]
include::in.asciidoc[]
include::like.asciidoc[]
include::rlike.asciidoc[]
include::search.asciidoc[]
23 changes: 23 additions & 0 deletions docs/reference/esql/functions/search.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[discrete]
[[esql-search-operators]]
=== Search operators

The only search operator is match (`:`).

preview::["Do not use on production environments. This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features."]

The match operator performs a <<query-dsl-match-query,match query>> on the specified field. Returns true if the provided query matches the row.

[.text-center]
image::esql/functions/signature/match_operator.svg[Embedded,opts=inline]

include::types/match.asciidoc[]

[source.merge.styled,esql]
----
include::{esql-specs}/match-operator.csv-spec[tag=match-with-field]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/match-operator.csv-spec[tag=match-with-field-result]
|===
1 change: 1 addition & 0 deletions docs/reference/esql/functions/signature/match_operator.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/reference/esql/functions/types/match_operator.asciidoc

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 @@ -14,9 +14,6 @@
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.xpack.esql.VerificationException;
import org.elasticsearch.xpack.esql.action.AbstractEsqlIntegTestCase;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.action.EsqlQueryRequest;
import org.elasticsearch.xpack.esql.action.EsqlQueryResponse;
import org.junit.Before;

import java.util.List;
Expand All @@ -32,12 +29,6 @@ public void setupIndex() {
createAndPopulateIndex();
}

@Override
protected EsqlQueryResponse run(EsqlQueryRequest request) {
assumeTrue("match operator capability not available", EsqlCapabilities.Cap.MATCH_OPERATOR_COLON.isEnabled());
return super.run(request);
}

public void testSimpleWhereMatch() {
var query = """
FROM test
Expand Down
4 changes: 1 addition & 3 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ WS
: [ \r\n\t]+ -> channel(HIDDEN)
;

COLON : ':';

//
// Expression - used by most command
//
Expand Down Expand Up @@ -184,6 +182,7 @@ AND : 'and';
ASC : 'asc';
ASSIGN : '=';
CAST_OP : '::';
COLON : ':';
COMMA : ',';
DESC : 'desc';
DOT : '.';
Expand Down Expand Up @@ -216,7 +215,6 @@ MINUS : '-';
ASTERISK : '*';
SLASH : '/';
PERCENT : '%';
EXPRESSION_COLON : {this.isDevVersion()}? COLON -> type(COLON);

NESTED_WHERE : WHERE -> type(WHERE);

Expand Down
34 changes: 17 additions & 17 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens

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

2 changes: 1 addition & 1 deletion x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ booleanExpression
| left=booleanExpression operator=OR right=booleanExpression #logicalBinary
| valueExpression (NOT)? IN LP valueExpression (COMMA valueExpression)* RP #logicalIn
| valueExpression IS NOT? NULL #isNull
| {this.isDevVersion()}? matchBooleanExpression #matchExpression
| matchBooleanExpression #matchExpression
;

regexBooleanExpression
Expand Down
34 changes: 17 additions & 17 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.tokens

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 @@ -306,7 +306,7 @@ public enum Cap {
/**
* Support for match operator as a colon. Previous support for match operator as MATCH has been removed
*/
MATCH_OPERATOR_COLON(Build.current().isSnapshot()),
MATCH_OPERATOR_COLON,

/**
* Removing support for the {@code META} keyword.
Expand Down

Large diffs are not rendered by default.

Loading
Loading