Browse Source

Add LIKE and RLIKE. Move operators to syntax page

Abdon Pijpelink 2 years ago
parent
commit
7edabb1d0b

+ 2 - 22
docs/reference/esql/esql-processing-commands.asciidoc

@@ -273,7 +273,7 @@ FROM employees
 | WHERE still_hired == true
 ----
 
-Which, because `still_hired` is a boolean field, can be simplified to:
+Which, if `still_hired` is a boolean field, can be simplified to:
 
 [source,esql]
 ----
@@ -284,28 +284,8 @@ FROM employees
 
 [discrete]
 ==== Operators
-These comparison operators are supported:
 
-* equality: `==`
-* inequality: `!=`
-* comparison: 
-** less than: `<`
-** less than or equal: `<=`
-** larger than: `>`
-** larger than or equal: `>=`
-
-You can use the following boolean operators:
-
-* `AND`
-* `OR`
-* `NOT`
-
-[source,esql]
-----
-FROM employees
-| PROJECT first_name, last_name, height, still_hired
-| WHERE height > 2 AND NOT still_hired
-----
+Refer to <<esql-operators>> for an overview of the supported operators.
 
 [discrete]
 ==== Functions 

+ 47 - 1
docs/reference/esql/esql-syntax.asciidoc

@@ -57,9 +57,55 @@ FROM employees
 | WHERE height > 2
 ----
 
+[discrete]
+[[esql-operators]]
+=== Operators
+These comparison operators are supported:
+
+* equality: `==`
+* inequality: `!=`
+* comparison: 
+** less than: `<`
+** less than or equal: `<=`
+** larger than: `>`
+** larger than or equal: `>=`
+
+For string comparison using wildcards or regular expressions, use `LIKE` or
+`RLIKE`:
+
+* Use `LIKE` to match strings using wildcards. The following wildcard characters
+are supported:
++
+--
+** `*` matches zero or more characters. 
+** `?` matches one character. 
+
+[source,esql]
+----
+FROM employees 
+| WHERE first_name LIKE "?b*" 
+| PROJECT first_name, last_name
+----
+--
+
+* Use `RLIKE` to match strings using <<regexp-syntax,regular expressions>>:
++
+[source,esql]
+----
+FROM employees 
+| WHERE first_name RLIKE ".leja.*" 
+| PROJECT first_name, last_name
+----
+
+The following boolean operators are supported:
+
+* `AND`
+* `OR`
+* `NOT`
+
 [discrete]
 [[esql-timespan-literals]]
-=== ESQL timespan literals
+=== Timespan literals
 
 Datetime intervals and timespans can be expressed using timespan literals.
 Timespan literals are a combination of a number and a qualifier. These