# Advanced Operators

These instructions apply to the current Admin Console.

## CLQL Advanced Operators

CLQL supports basic operators (=, !=, \<, \<=, \>, \>=, \<\>, in, not, not in). For example:

> \_level in (warn, error)
>
> \_level not in (debug, info)

Below are some **advanced** operators.

### matches

Use a regex-like pattern on a string property:

> \_message matches ab.

The matches pattern dialect supports:

| **Pattern**  | **Meaning**                           | **Matches**                         |
|--------------|---------------------------------------|-------------------------------------|
| ab.          | Any character                         | 'aba', 'abb', 'abz', etc.           |
| abc?         | Optional character                    | 'ab' and 'abc'                      |
| ab+          | One or more                           | 'ab', 'abb', 'abbb', etc.           |
| a{2,4}       | Repeat count                          | 'aa', 'aaa', and 'aaaa'             |
| abc\|xyz     | Alternation                           | 'abc' or 'xyz'                      |
| abc(def)?    | Group                                 | 'abc' or 'abcdef' but not 'abcd'    |
| \[abc\]      | Character class                       | 'a', 'b', 'c'                       |
| a~bc         | ~ means not, for the next character   | 'adc' and 'aec' but not 'abc'       |
| \#\|abc      | Match only this value, not even empty | 'abc' but nothing else              |
| foo\<1-100\> | Numeric range                         | 'foo1', 'foo2', …, 'foo100'         |
| aaa.+&.+ccc  | & means AND of two patterns           | 'aaabbbccc'                         |
| @&~(abc.+)   | @ means everything                    | Everything not beginning with 'abc' |

For prefix searches, use `=` with a wildcard, for example `_instance = http*`.

### where

Filter search results conditionally.

- Must start on a new line

- Must be preceded by \|

> \| where \_instance = http\*

For example, to find warnings and errors from HTTP instances:

> \_level in (warn, error)
>
> \| where \_instance = http\*

### exists

Check if a value exists for a specified field.

> \| where \_name exists

### sort by

Order search results by a specified field.

- Must start on a new line

- Must be preceded by \|

- Default order is desc (descending). Use asc for ascending.

> \| sort by \_createdAt asc

### limit

Return only the first n matching messages.

- Must start on a new line

- Must be preceded by \|

> \| limit 100
>
> **Note:** If a \| stage is on the same line as the search, the query returns no results. Put each stage on its own line.
