> For the complete documentation index, see [llms.txt](https://docs.contextual.io/documentation-and-resources/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.contextual.io/documentation-and-resources/tenants/tenant-logs/contextual-log-query-language-clql/advanced-operators.md).

# Advanced Operators

## CLQL Advanced Operators

CLQL supports basic operators (`=`, `!=`, `<`, `<=`, `>`, `>=`, `<>`, `in`, `not`, `not in`).

Below are some **advanced** operators:

### `matches`

Use a regex-like pattern on a string property.

```graphql
# Match 'aba', 'abb', 'abz', etc.
_message matches ab.

# Match 'ab' and 'abc'
_message matches abc?

# Match 'ab', 'abb', 'abbb', etc.
_message matches ab+

# Match 'a', 'ab', 'abb', 'abbb', etc.
_message matches ab*

# Match 'aa', 'aaa', and 'aaaa'
_message matches a{2,4}

# Match 'abc' or 'xyz'
_message matches abc|xyz

# Match 'abc' or 'abcdef' but not 'abcd'
_message matches abc(def)?

# Match 'a', 'b', 'c'
_message matches [abc]

# Match 'adc' and 'aec' but not 'abc'
_message matches a~bc

# Match 'abc' but nothing else
_message matches #|abc

# Match 'foo1', 'foo2', ..., 'foo100'
_message matches foo<1-100>

# Match 'aaabbbccc'
_message matches aaa.+&.+ccc

# Match everything not beginning with 'abc'
_message matches @&~(abc.+)
```

### `where`

Filter search results conditionally.

* Must start on a new line
* Must be preceded by `|`

```graphql
| where _instance matches http*
```

### `exists`

Check if a value exists for a specified field.

```graphql
| 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)

```graphql
| sort by _createdAt asc
```

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.contextual.io/documentation-and-resources/tenants/tenant-logs/contextual-log-query-language-clql/advanced-operators.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
