Skip to content

Instantly share code, notes, and snippets.

@nik9000
Last active July 24, 2024 19:40
Show Gist options
  • Save nik9000/38946d2ba2639db64fe5ee28d0b805a7 to your computer and use it in GitHub Desktop.
Save nik9000/38946d2ba2639db64fe5ee28d0b805a7 to your computer and use it in GitHub Desktop.
diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/match.csv-spec b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/match.csv-spec
new file mode 100644
index 00000000000..80e07e33b5c
--- /dev/null
+++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/match.csv-spec
@@ -0,0 +1,21 @@
+keyword
+required_capability: match
+
+FROM employees
+| WHERE last_name MATCH "Bamford"
+| KEEP emp_no, first_name, last_name;
+
+emp_no:integer | first_name:keyword | last_name:keyword
+ 10003 | Parto | Bamford
+;
+
+text
+required_capability: match
+
+FROM airports
+| WHERE name MATCH "Lennon"
+| KEEP abbrev, name;
+
+abbrev:keyword | name:text
+ LPL | Liverpool John Lennon
+;
diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
index f6e8200bf16..31dd0f1eacc 100644
--- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
+++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
@@ -170,7 +170,12 @@ public class EsqlCapabilities {
* Fix for non-unique attribute names in ROW and logical plans.
* https://github.com/elastic/elasticsearch/issues/110541
*/
- UNIQUE_NAMES;
+ UNIQUE_NAMES,
+
+ /**
+ * Support for the {@code MATCH} operator.
+ */
+ MATCH(true);
private final boolean snapshotOnly;
diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java
index 49d3c0d74db..cfa40c9b8f1 100644
--- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java
+++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/CsvTests.java
@@ -243,6 +243,7 @@ public class CsvTests extends ESTestCase {
"multiple indices aren't supported",
testCase.requiredCapabilities.contains(EsqlCapabilities.Cap.UNION_TYPES.capabilityName())
);
+ assumeFalse("MATCH is unsupported in unit style csv tests", testCase.requiredCapabilities.contains(EsqlCapabilities.Cap.MATCH.capabilityName()));
if (Build.current().isSnapshot()) {
assertThat(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment