Going Stellar

Home/CQL reference

CQL operator

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

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

ArgumentWhat it doesOptional
fieldA CQL field that supports NOT IN, such as type, space, title, ancestor, id or fileExtension.yes
valuesOne or more values in parentheses, separated by commas. Quote text that contains spaces.yes

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 .

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 .

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

Removes image attachments from a result when you hunt for documents.

Run on Confluence Cloud on .

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 .

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 .

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.

Sources

  1. CQL operators (Atlassian Developer, Confluence Cloud)
  2. CQL fields (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages