Using CQL

CQL queries are made up of three parts:

  • Field (examples: space, creator, lastModified)

  • Operator (like = or !=)

  • Value/Function (what you want to search for)

Simple CQL query example

field = "value"

To search for a specific label in your Confluence instances, use the field label followed by the operator = followed by a value test to search for the test label.

CQL query search results

Combined CQL statements example

field = "value" AND field = "value"

You can combine CQL statements for more advanced searches using AND and OR.

  1. Use the previous example of label = "test" 
  2. Add an operator of AND to search for a second statement to search for a label of users, label = "users".

CQL query search results

Multiple CQL statements

(field = "value" *AND field = "value") OR (*field = "value")

You can use the order of operations to search for multiple CQL statements.

  1. Use the previous example of label = "test" AND label = "users"
  2. Add a statement for the title "Development Work" without needing that space to have the labels of "test" and "users."

CQL query search results

More examples

Here are some examples of CQL queries:

  • Return all pages, blog posts, comments, or attachments contained within the DS space:

    space = "DS"
  • Return all pages within the DS space:

    space = "DS" and type = page
  • Return all pages that contain the phrase "start a discussion:

    siteSearch ~ "start a discussion"
  • Return all content created by the currently logged in user:

    creator = currentUser()

Atlassian Documentation

For more information, visit Advanced Searching Using CQL and Performing Text Searches Using CQL Atlassian documentation.

On this page