Going Stellar

Home/CQL reference

CQL keyword

OR keyword in CQL (Confluence): syntax and examples

OR joins clauses and returns content that matches at least one of them. Use it to widen a search across spaces, words or dates. It binds weaker than AND, so group it with parentheses whenever you combine the two.

Syntax

clause1 OR clause2
(clause1 or 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 inside a clause, such as startOfYear() or now().
  • Not with: a leading or trailing OR. It needs a clause on each side.

Examples

space = SD or space = "Gigi"

Searches two spaces at once.

Run on Confluence Cloud on .

title ~ "runbook" or title ~ "handbook" or title ~ "policy"

Finds the operating documents of a team under any of three names.

Run on Confluence Cloud on .

type = page and (title ~ "runbook" or title ~ "policy") and space = SD

Keeps the either-or part inside parentheses so the type and space limits apply to both words.

Run on Confluence Cloud on .

lastModified < startOfYear() or label = needs_review

Pulls stale content together with anything someone flagged for review. Taken from the documentation with a label that suits a review queue.

Run on Confluence Cloud on .

title ~ "runbook" or title ~ "handbook" order by title

Shows results from both words in alphabetical order.

Run on Confluence Cloud on .

Pitfalls

  • OR does not cut AND short. In type = page and space = SD or type = attachment the AND pair is evaluated first, then OR adds every attachment from any space. Wrap the OR in parentheses to limit it.
  • When OR compares one field with several values, IN is easier to read and edit: type in (page, attachment) replaces two = clauses.
  • Lowercase or works the same as OR (checked on Confluence Cloud, November 2026). A query that begins with OR is a syntax error.
  • An OR on a field with no data is not an error. A label clause on a space without labels just matches nothing, so the rest of the query still returns results.

Sources

  1. CQL keywords (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages