JQL for labels does not return correct results

I have a query that returns 25 issues. Out of these 25 issues, 2 have label xxx.

I add to my JQL, AND Labels not in ("xxx") and I get 10 issues. I replace it with AND Labels in ("xxx") and I get 2 issues. Something here is wrong. Any ideas?


9 answers

1 accepted

5 votes
Accepted answer

I guess out of the 25 issues 13 have no labels at all. That would explain the two other result sets (2 and 10).

Note: label not in (xxx) will display all issues where the label is different from xxx and not empty

Any way I can capture the 23 tickets that I am looking for?

yes, use

AND (Labels not in ("xxx") or labels is EMPTY)

edit: sorry, this is how it should work

So, your query basically excludes the items which does not contain any label.


You can try this instead: 

(labels != "LBL1" OR labels = null)

labels =null will not work, you need to use labels is empty to capture those issues with no label

0 votes

I can't see the difference between your queries or how you are entering them, it just says "and labels in xxx" twice.

One is with "NOT".
0 votes
Joe Wai Tye Atlassian Team Nov 10, 2013
Hey there, have you tried re-indexing? Quite a lot of search-related issues could be caused by the index. Please try to perform a complete re-index, and see if the problem persists
0 votes

I suspect we might want to see the definitions of both queries in full. It can be important where and how a clause is added to a query. (If not, then re-indexing is the next step)

0 votes

Sorry, obviously not enough coffee this morning.

Please Re-index.

if not he can do indexing through the groovy code for issues in the filter(25 issues) that he has mentioned.

it wont take much time I guess.

You don't know that indexing is the problem yet. It could be the structure of the query.

the JQL is : project = projectname AND resolution = Unresolved AND fixVersion = EMPTY AND labels in ("labelname")

Ah, good. Sort of. That query is not structured in a way that might be causing a problem. Straight clauses joined by "and"s are almost always straightforward.

So, now we need to ask you to test the effects of re-indexing

As per my understanding *[labels = null]* and [labels is EMPTY] doesn't makes any difference in results. I have tested with both the options and got the same result.

true, unless someone adds a label named "null"

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,295 views 5 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you