CQL field
text in CQL (Confluence): syntax and examples
The text field is a master field that searches the title, the body and the labels of content in one go, like the search box in the Confluence UI. It only works with the contains operators. Use it when you know a word but not where it appears.
Syntax
text ~ "word"
text ~ "\"exact phrase\""
text !~ "word"
Arguments
| Argument | What it does |
|---|---|
value | A word or phrase in double quotes. Add * for several characters or ? for one. Wrap a phrase in escaped inner quotes to keep the words together in order. |
Works with
- Operators: ~, !~
- Functions: none
- Not with: =, !=, IN, NOT IN, >, >=, <, <=
Examples
text ~ "checkout" AND type = page AND space = SD ORDER BY lastmodified DESCFinds every page that mentions a feature, the one you edited last first.
Run on Confluence Cloud on .
text ~ "\"incident response\""Finds pages where the two words appear next to each other, in that order.
Run on Confluence Cloud on .
text ~ "check*"Catches variants such as checkout and checklist with one wildcard.
Run on Confluence Cloud on .
text ~ "release checklist" AND type = commentLooks for review discussion on a topic, restricted to comments.
Run on Confluence Cloud on .
text !~ "checkout" AND type = page AND space = SDLists pages that never mention a topic, for example to see what a rename has not reached.
Run on Confluence Cloud on .
Pitfalls
- Only
~and!~work.text = "checkout"andtext != "checkout"fail with "Could not parse cql".text in ("a", "b")fails with "Operator 'in' is not supported for field 'text'. Supported operators are : ~, !~". - An empty value is a server error, not an empty result:
text ~ ""returns HTTP 500 "java.lang.NullPointerException: query parameter is required." Check for empty input before building a query from user input. - A word is not found from the middle or from a split spelling.
text ~ "*kout"andtext ~ "check out"find nothing wheretext ~ "chec?out"finds the page. Attachments are not matched by file name:text ~ "roadmap" AND type = attachmentfinds nothing, whiletitle ~ "roadmap*" AND type = attachmentfinds roadmap.svg. - Search words inside the quotes behave like search-box operators (checked on Confluence Cloud, November 2026).
text ~ "checkout OR payment"widens the match,"checkout AND runbook"narrows it and"checkout -payment"excludes a word. Without them,"checkout payment"needs both words.
Questions and answers
Does text search attachment contents?
Searching a file name did not work in our checks. Search attachments with type = attachment and title ~ instead.