Advanced searching

The advanced search allows you to build structured queries using the JIRA Query Language (JQL) to search for issues. You can specify criteria that cannot be defined in the quick or basic searches (e.g. ORDER BY clause). 

  • If you don't have complex search criteria, you may want to use quick search instead.
  • If you are not comfortable with the JIRA Query Language (JQL), you may want to use basic search instead.

Note, JQL is not a database query language, even though it uses SQL-like syntax. 

Screenshot: Advanced search

On this page:

Advanced searching

  1. Navigate to Issues (in header) > Search for issues.
    • If there are existing search criteria, click the New filter button to reset the search criteria.
    • If the basic search is shown instead of the advanced search, click Advanced (next to the  icon).

      Why can't I switch between basic and advanced search?

      In general, a query created using basic search will be able to be translated to advanced search, and back again. However, a query created using advanced search may not be able to be translated to basic search, particularly if:

      • the query contains an OR operator (note you can have an IN operator and it will be translated, e.g. project in (A, B))
        • i.e. even though this query: (project = JRA OR project = CONF) is equivalent to this query: (project in (JRA, CONF)), only the second query will be translated.
      • the query contains a NOT operator
      • the query contains an EMPTY operator
      • the query contains any of the comparison operators: !=, IS, IS NOT, >, >=, <, <=
      • the query specifies a field and value that is related to a project (e.g. version, component, custom fields) and the project is not explicitly included in the query (e.g. fixVersion = "4.0", without the AND project=JRA). This is especially tricky with custom fields since they can be configured on a Project/Issue Type basis. The general rule of thumb is that if the query cannot be created in the basic search form, then it will not be able to be translated from advanced search to basic search.
  2. Enter your JQL query. As you type, JIRA will offer a list of "auto-complete" suggestions based on the context of your query. Note, auto-complete suggestions only include the first 15 matches, displayed alphabetically, so you may need to enter more text if you can't find a match.

    Why aren't the auto-complete suggestions being shown?
    • Your administrator may have disabled the "JQL Auto-complete" feature for your JIRA instance.
    • Auto-complete suggestions are not offered for function parameters.
    • Auto-complete suggestions are not offered for all fields. Check the fields reference to see which fields support auto-complete.
  3. Press Enter or click  to run your query. Your search results will display in the issue navigator.

Understanding advanced searching

Read the following topics to learn how to get the most out of advanced searching:

Constructing JQL queries

A simple query in JQL (also known as a 'clause') consists of a field, followed by an operator, followed by one or more values or functions. For example:

project = "TEST"

This query will find all issues in the "TEST" project. It uses the "project" field, the EQUALS operator, and the value "TEST".

A more complex query might look like this:

project = "TEST" AND assignee = currentuser()

This query will find all issues in the "TEST" project where the assignee is the currently logged in user. It uses the "project" field, the EQUALS operator, the value "TEST",the "AND" keyword and the "currentuser()" function.

For more information on fields, operators, keywords and functions, see the Reference section below.

Precedence in JQL queries

Precedence in JQL queries depends on keywords that you use to connect your clauses (a clause being e.g. project = “Teams in Space”). The easiest way to look at this is to treat the AND keyword as the one grouping clauses, and OR as the one separating them. The AND keyword takes precedence over other keywords, because it groups clauses together, essentially turning them into one combined clause.

Example 1

status=resolved AND project=“Teams in Space” OR assignee=captainjoe

This query will return all resolved issues from the “Teams in Space” project (clauses grouped by AND), and also all existing issues assigned to captainjoe. The clause after the OR keyword is treated as separate.

Example 2

status=resolved OR project="Teams in Space" AND assignee=captainjoe

This query, on the other hand, will return captainjoe’s issues from the “Teams in Space” project (clauses grouped by AND), and also all existing resolved issues (a clause separated by OR).

Example 3

status=resolved OR projects="Teams in Space" OR assigne=captainjoe

When you only use the OR keyword, all clauses will be treated as separate, and equal in terms of precedence.

Setting the precedence

You can set precedence in your JQL queries by using parentheses. Parentheses will group certain clauses together and enforce precedence.

Example 1

As you can see below, parentheses can turn our example JQL query around. This query would return resolved issues that either belong to the “Teams in Space” project, or are assigned to captainjoe.

status=resolved AND (project="Teams in Space" OR assignee=captainjoe)

Example 2

If you used parentheses like in the following example, they wouldn’t have any effect, because the clauses enclosed in parentheses were already connected by AND. This query would return the same results with or without the parentheses.

(status=resolved AND project="Teams in Space") OR assignee=captainjoe

Restricted words and characters

Reserved characters

JQL has a list of reserved characters:

space (" ")+.,;?|*/%^$#@[]

If you wish to use these characters in queries, you need to:

  • surround them with quote-marks (you can use either single quote-marks (') or double quote-marks ("));
    and, 
  • if you are searching a text field and the character is on the list of special characters in text searches, precede them with two backslashes. This will let you run the query that contains a reserved character, but the character itself will be ignored in your query. For more info, see Special characters in Search syntax for text fields.

For example:

  • version = "[example]"
  • summary ~ "\\[example\\]"

Reserved words

JQL also has a list of reserved words. These words need to be surrounded by quote-marks (single or double) if you wish to use them in queries.

Show me...

"abort", "access", "add", "after", "alias", "all", "alter", "and", "any", "as", "asc", "audit", "avg", "before", "begin", "between", "boolean", "break", "by", "byte", "catch", "cf", "char", "character", "check", "checkpoint", "collate", "collation", "column", "commit", "connect", "continue", "count", "create", "current", "date", "decimal", "declare", "decrement", "default", "defaults", "define", "delete", "delimiter", "desc", "difference", "distinct", "divide", "do", "double", "drop", "else", "empty", "encoding", "end", "equals", "escape", "exclusive", "exec", "execute", "exists", "explain", "false", "fetch", "file", "field", "first", "float", "for", "from", "function", "go", "goto", "grant", "greater", "group", "having", "identified", "if", "immediate", "in", "increment", "index", "initial", "inner", "inout", "input", "insert", "int", "integer", "intersect", "intersection", "into", "is", "isempty", "isnull", "join", "last", "left", "less", "like", "limit", "lock", "long", "max", "min", "minus", "mode", "modify", "modulo", "more", "multiply", "next", "noaudit", "not", "notin", "nowait", "null", "number", "object", "of", "on", "option", "or", "order", "outer", "output", "power", "previous", "prior", "privileges", "public", "raise", "raw", "remainder", "rename", "resource", "return", "returns", "revoke", "right", "row", "rowid", "rownum", "rows", "select", "session", "set", "share", "size", "sqrt", "start", "strict", "string", "subtract", "sum", "synonym", "table", "then", "to", "trans", "transaction", "trigger", "true", "uid", "union", "unique", "update", "user", "validate", "values", "view", "when", "whenever", "where", "while", "with"

Note for JIRA administrators: this list is hard coded in the JqlStringSupportImpl.java file.

Performing text searches

You can use Lucene's text-searching features when performing searches on the following fields, using the CONTAINS operator:

Summary, Description, Environment, Comments, custom fields that use the "Free Text Searcher" (i.e. custom fields of the following built-in custom field types: Free Text Field, Text Field, Read-only Text Field).

For more information, see Search syntax for text fields.

Reference


DescriptionReference
FieldsA field in JQL is a word that represents a JIRA field (or a custom field that has already been defined in JIRA).
OperatorsAn operator in JQL is one or more symbols or words that compare the value of a field on its left with one or more values (or functions) on its right, such that only true results are retrieved by the clause. Some operators may use the NOT keyword.

Operators reference page

Show list of operators

Keywords

A keyword in JQL is a word or phrase that does (or is) any of the following:

  • joins two or more clauses together to form a complex JQL query
  • alters the logic of one or more clauses
  • alters the logic of operators
  • has an explicit definition in a JQL query
  • performs a specific function that alters the results of a JQL query.

Keywords reference page

Show list of keywords

Functions

A function in JQL appears as a word followed by parentheses, which may contain one or more explicit values or JIRA fields.

A function performs a calculation on either specific JIRA data or the function's content in parentheses, such that only true results are retrieved by the function, and then again by the clause in which the function is used.

Running a saved search

Saved searches (also known as Saving your search as a filter) are shown in the left panel, when using advanced search. If the left panel is not showing, hover your mouse over the left side of the screen to display it.

To run a filter, e.g. My Open Issues, simply click it. The JQL for the advanced search will be set, and the search results will be displayed.

Next steps

Read the following related topics:

Last modified on Sep 3, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.