Courtesy - DALL-E
JQL stands for "Jira Query Language," and it is a powerful search language used to query Jira data. JQL allows users to search for issues in Jira by specifying criteria such as issue type, status, project, assignee, and custom fields. It can be used to filter and sort issues, create custom reports, and automate processes within Jira.
JQL syntax is similar to SQL, but it is specific to Jira and is used within Jira's search interface. JQL can be used by both technical and non-technical users to find, analyze, and report on data within Jira.
This blog is intended to be a tutorial for those who have no experience with database queries or SQL queries to those who want faster access to information in Jira. So basically if you use Jira then this blog is for you.
When using the Jira console, there are a few places you can start searching depending on what you're looking for. Here are some common options:
1 - Quick Search: At the top of the Jira console, you'll see a Quick Search bar. This is a simple text search that lets you search across all issues in Jira. Simply type in your search term and press Enter to see a list of matching issues.
2 - Filter Navigator: If you need to perform a more complex search, you can use the Filter Navigator. This is accessible via the "Filters" dropdown menu in the Jira console. The Filter Navigator lets you build more advanced queries using JQL or a graphical interface.
Depending on what you're looking for, one or more of these options may be a good place to start your search in Jira.
Jira provides two types of searches: basic and advanced.
Basic Search: Basic search is a simple text search that allows you to search for issues in Jira based on keywords. You can access the basic search bar by clicking on the search icon in the Jira header. This search bar is located in the top navigation bar, and it allows you to enter one or more keywords to search for issues. The basic search will match against the summary, description, and other fields in Jira. You can also use basic search operators such as "AND," "OR," and "NOT" to refine your search.
Advanced Search: Advanced search allows you to build complex queries using the Jira Query Language (JQL). You can access the advanced search by clicking on the "Advanced Search" link in the basic search dropdown menu. Advanced search provides a more powerful and flexible way to search for issues based on specific criteria such as issue type, status, project, assignee, and custom fields. You can use JQL to create more complex queries and combine multiple criteria. You can save your search queries and share them with other users or use them to create filters and dashboards.
We will focus more on JQL for the remainder of this blog.
The basic structure of a JQL query consists of three components:
<field> <operator> <value> <keyword>
Field: Refers to the Jira field that you want to search for. Examples include:
Assignee, Affected version, Attachments, Comment, Component, Created, Creator, Description, Due, Epic link, Filter, Fix version, Issue key, Labels, Last viewed, Priority, Project, Reporter, Resolved, Sprint, Status, Summary, Text, Time spent, Voter, Watcher, custom field – Any custom field defined by the administrator and accessible to the user
Operator: Specifies the comparison operator that you want to use to compare the field to the value. Examples of operators include:
=, !=, >, <, >=, <=, ~, !~, IN, NOT IN, IS, IS NOT, WAS, WAS NOT, WAS IN, WAS NOT IN, CHANGED
Value: Refers to the value that you want to compare the field against. You could also use some pre-built functions to return dynamic values, these functions include:
Time related: startOfDay/Week/Month/Year, endOfDay/Week/Month/Year, lastLogin(), now(), currentLogin()
People related: currentUser(), membersOf()
Issue related: issueHistory() openSprints() watchedIssues() myApproval() myPending()
Keyword: To perform complex searches, the following keywords help link search clauses together “AND”, “OR” and “IS”
It's important to note that JQL is case-insensitive and can use parentheses to group clauses, allowing for more complex queries. Additionally, JQL supports functions that can be used to search for issues with certain attributes or characteristics.
Here are a couple of examples
project = Acme AND status != Closed
In this query, "project" is the field, "=" is the operator, and "Acme" is the value. The "AND" operator is used to combine two clauses: the project is "Acme," and the status is not "Closed." together
project = "Acme Project" AND status = "In Progress"
This query will find all issues in the "Acme Project" that are currently in the "In Progress" status.
created >= -7d
This query will find all issues created within the last 7 days.
labels = "security-issue"
This query will find all issues with the "security-issue" label.
issuetype = Bug AND resolution = "Cannot Reproduce"
This query will find all bugs that have been marked with the "Cannot Reproduce" resolution.
text ~ "error message"
This query will find all issues that contain the phrase "error message" in the summary or description.
In JQL there are several reserved characters and words that have special meaning and are used to build queries. These include:
Reserved Characters:
Parentheses: () - Used to group clauses in a query
Quotation marks: "" - Used to enclose phrases or words that have spaces in them
Asterisk: * - Used as a wildcard to represent any number of characters in a search
Question mark: ? - Used as a wildcard to represent a single character in a search
Boolean operators: AND, OR, NOT - Used to combine multiple search criteria
Reserved Words:
a, and, are, as, at, be, but, by, for, if, in, into, is, it, no, not, of, on, or, s, such, t, that, the, their, then, there, these, they, this, to, was, will, with
Replace single character with ? example - m?t
Replace multiple characters with * example - win*
Add ~ to the end of a single term e.g. marry~
Add ~ to the end of a single term e.g. marry~
There can be numerous use cases for JQL as it makes information in Jira accessible easily to all the stakeholders who use Jira, including Jira administrators, Users, Project administrators etc.. enabling each of them to easily create custom queries to suit their specific needs.
JQL is a powerful query language used to search and filter issues in Jira. It allows users to create custom queries to search for specific issues based on a wide range of criteria, including issue type, status, priority, assignee, and more.
JQL provides a number of benefits, including efficient searching, customizable queries, easy automation, cross-project searching, and standardized language. Some common use cases for JQL include issue tracking, reporting, project management, resource allocation, customer support, bug tracking, and quality assurance.
Overall, JQL is a versatile tool that can help users save time, increase productivity, and make more informed decisions when managing projects and issues in Jira.