Going Stellar

Home/CQL reference

CQL keyword

AND keyword in CQL (Confluence): syntax and examples

AND joins two clauses and keeps only the content that matches both. Chain as many as you need to narrow a search. When you mix AND with OR in one query, AND is evaluated first.

Syntax

clause1 AND clause2
clause1 and clause2 and clause3

Arguments

ArgumentWhat it doesOptional
clauseAny CQL clause of the form field operator value.yes

Works with

  • Operators: joins clauses that use any operator.
  • Functions: any function that sits inside a clause, such as currentUser() or now().
  • Not with: a leading or trailing AND. It needs a clause on each side.

Examples

type = page and space = SD and title ~ "policy"

Finds policy pages in one space only.

Run on Confluence Cloud on .

type = attachment and (fileExtension = "svg" or fileExtension = "jpg")

Limits an either-or choice to attachments by grouping it in parentheses.

Run on Confluence Cloud on .

type = page and title ~ "runbook" and ancestor = 32964613

Finds runbooks that sit under the company handbook.

Run on Confluence Cloud on .

type = page and space = SD and lastmodified >= now("-2w") and creator = currentUser()

Lists your own pages in a space that changed in the last two weeks.

Run on Confluence Cloud on .

type = page AND space = SD

Same as the lowercase form, written in capitals the way most CQL guides do.

Run on Confluence Cloud on .

Pitfalls

  • AND is evaluated before OR. type = comment or type = page and title ~ "checkout" returns every comment plus the matching page, while (type = comment or type = page) and title ~ "checkout" returns the page only (checked on Confluence Cloud, November 2026). Add parentheses when you mean the second one.
  • Case does not matter. and, AND and And all run (checked on Confluence Cloud, November 2026), so the lowercase keywords in the Atlassian examples are fine.
  • Two clauses with nothing between them are not joined. type = page space = SD is a syntax error, and the error text is only "Could not parse cql".
  • A comma is not AND. To match several values of one field use IN, since one field can hold only one value for most content.

Sources

  1. CQL keywords (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages