# NOT IN operator in CQL (Confluence): syntax, examples

URL: https://goingstellar.ro/reference/cql/not-in-operator/

NOT IN keeps content whose field matches none of the listed values. It is the shorter form of several != clauses joined with AND. Use it to drop file types, content types or known pages from a result.

## Syntax

```
field NOT IN (value1, value2, ...)
field not in (value1, value2)
```

## Arguments

- `field` (optional: yes): A CQL field that supports NOT IN, such as type, space, title, ancestor, id or fileExtension.
- `values` (optional: yes): One or more values in parentheses, separated by commas. Quote text that contains spaces.

## Works with

- Operators: NOT IN works on the same fields as IN: ancestor, content, contributor, creator, favourite, fileExtension, id, label, macro, mention, owner, pageStatus, space, subtype, title, type and watcher.
- Functions: currentUser() inside the list, for user fields.
- Not with: created, lastmodified, text, and parent (fails, see the pitfalls).

## Examples

```
space = SD and type not in (attachment, comment)
```

Shows only real content in a space, without uploaded files or comments. Run on Confluence Cloud on 2026-11-29.

```
type = page and space = SD and title not in ("Code of Conduct", "Travel and Expense Policy")
```

Lists a space's pages but skips two pages that were already reviewed. Run on Confluence Cloud on 2026-11-29.

```
fileExtension not in ("svg", "jpg")
```

Removes image attachments from a result when you hunt for documents. Run on Confluence Cloud on 2026-11-29.

```
ancestor not in (32964613) and space = SD and type = page
```

Finds pages in a space that are not part of the company handbook tree. Run on Confluence Cloud on 2026-11-29.

```
label not in ("archived", "obsolete") and type = page and space = SD
```

Hides pages that carry either of two housekeeping labels. Run on Confluence Cloud on 2026-11-29.

## Pitfalls

- `parent not in (32964613, 655541)` fails with HTTP 500 and "IllegalArgumentException executing cql", although the documentation lists the operator for parent. Use `parent != 32964613`, or `ancestor not in (...)` (checked on Confluence Cloud, November 2026).
- `text not in ("checkout")` fails with "Operator 'notin' is not supported for field 'text'. Supported operators are : ~, !~". The same error appears for created and lastmodified, which take comparison operators.
- The documentation says NOT IN does not work on `title`. It does (checked on Confluence Cloud, November 2026), so you can exclude a list of exact titles.
- `label not in (...)` also keeps content with no label at all, because that content holds none of the listed values. Add a positive filter if you only want labelled pages.

## Related

- [IN](https://goingstellar.ro/reference/cql/in-operator/)
- [!=](https://goingstellar.ro/reference/cql/not-equals-operator/)
- [NOT](https://goingstellar.ro/reference/cql/not-keyword/)
- [label](https://goingstellar.ro/reference/cql/label-field/)
- [fileExtension](https://goingstellar.ro/reference/cql/fileextension-field/)
- [type](https://goingstellar.ro/reference/cql/type-field/)

## Sources

- [CQL operators (Atlassian Developer, Confluence Cloud)](https://developer.atlassian.com/cloud/confluence/cql-operators/)
- [CQL fields (Atlassian Developer, Confluence Cloud)](https://developer.atlassian.com/cloud/confluence/cql-fields/)

