Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,328,546
Community Members
 
Community Events
168
Community Groups

How can I search for issues that do NOT have a certain label

I have tried various advanced searches and cannot get the syntax right. I want to look for all issues of certain status (for example, open or reopened or inprogress) but exclude any with a certain label (for example OnHold). Tried every kind of NOT but cannot get it to work. HELP please.

14 answers

1 accepted

94 votes
Answer accepted

had the same problem, solved it this way:

status in("open","reopened","inprogress") and (labels not in("OnHold") or labels is EMPTY)

It works for me. Thanks,

Like # people like this

Works perfectly

Worked! Thanks.

The case this doesn't resolve is for issues with any other labels.

In JIRA on demand this query returns the same issues as a query returning only issues with no labels. The inclusion of not in ("XXXX") makes no difference.

Like # people like this

You saved my day :)

This works for me just fine on JIRA v6.4.1. I didn't think to consider EMPTY like a NULL value that requires an explicit comparison. Thanks!

Perfect, just what I was looking for.

Nice. Many thanks.

Words cannot express my thanks!

Really saved my day thanks a lot🙂

It works like a dream!!!!! Thank you very much!!!!!

Nice.  thanks

Top stuff.  Thanks Miroslav

Great help. Thanks

Awesome!

Thank you

Thanks, works fine :) 

Woot woot for this post... learned something new about JQL today.

Like Italo _Modus Create_ likes this

With this JQL :

project = TEST AND status in ("open","reopened","inprogress") AND assignee in (usertest) ORDER BY created DESC

i have noting in "reopened" status, so the JQL is giving me an error :

The value 'reopened' doesn't exist in the field 'status'.

Do you have any idea how can i correct it ?

Thanks

It worked ! thanks a lot !

Saved my day - thanks!!

I have issues logged that have a "DEMO" label. operationally I want to filter these out, prety much as the OP. There wasn't a proper anser above, a couple of fragments so I eventually came up with:

    and (labels is empty or (labels is not empty and labels not in (DEMO)))

This means if it's empty, list it. If it has any label, filter out issues that have the DEMO label. Hope that clarifies things.

Deleted user Oct 07, 2015

Nice !

Like Arumugam Raman likes this

You are my hero! 

Unfortunately this doesn't seem to work for me.

the query is slightly more complicated:

project in (WIN) AND issuetype in (Epic, Initiative) AND status not in (Delivered, Closed, Cancelled) AND (labels not in ("Prime-Backlog") OR labels is EMPTY)

 

I get the same number of issues back with or without the last AND clause and get labels I don't want.

Like Brian Mackey likes this

Signed up just to say thank you and upvote. Helped me with my issue! Nigel Johnson!

Thank you.  This helped me with my issue!  

This makes the trick indeed: 

"

((labels is not EMPTY and labels not in (demo)) or labels is EMPTY))

"

For me the problem was before, that when I used simply the labels != demo, on top of filtering the items with "demo" labels, it as well filtered the issues with no labels.

 

Thx for the hint. :)

Like Jeppe Dam Sørensen likes this

Saved my life! Thank you!

Nice :-)  

I used it the other way:

(labels is EMPTY or labels not in (Household))

which worked, BUT I dont understand why the to test for EMPTY is necessary. 

Thanks in 2020 one more time :)

Still relevant in 2022, thanks alot!

May be caused by the problem I report in

https://answers.atlassian.com/questions/174362/search-with-not-requires-and-contrary-to-documentation

Seems to search for A and not B, you must say

A AND NOT B

not

A NOT B

which the documentation says.

Try

status in ("open","reopened","inprogress") and labels not in ("OnHold")

I tried adding a screen shot but it isn't showing...I'll try converting to JPG

It takes it but says no issues found, and there ARE issues with that label!!!

Notice, I can use "in" to find ones with the label, and it works, but the "not in" returns no entries, when there should be LOTS.

When you say NOT in, it will find issues without that label but in the mentioned statuses. Are you saying you have issues in those states without the label?

I added the picture, but cannot see the attachment???

I would raise the issue with Atlassian support.

PS. In Progress is two words, I fixed that.... still doesn't work

Correct. I have many issues in those statuses without that label. They either have NO label, or some other label, but the query returns NO entries whatsoever.

This does not work for me even a little bit.

How can I say that the text field does not contain a specific string?

 

This is for INCLUDING the text "missing":
project = MYPROJECT AND status = "To Do" AND assignee in (EMPTY) AND reporter in (jiramail) AND text ~ "missing" ORDER BY created DESC

How can I tweak this to make it show me issues that DO NOT INCLUDE the text "missing"?

Actually for me this worked:


labels not in (DEMO) OR labels is EMPTY

 

The OR clause is critical

I had same issue. Had difficulties to filter Labels. I am using version 7.5.3

(labels not in (X,Y) or labels is EMPTY ) and status in (Backlog, Analysis).

Adding the "labels is empty" helped.

Problem is correctly identified above by Thomas Tulinksy. Beware that adding "labels is empty" appears to help (i.e. you suddenly see results, hurrrah) but does not show any issue that has a different label (e.g. "Z")

To overcome it, you must use the AND NOT exactly as Thomas described.

Status in (Backlog, Analysis) AND (NOT labels in (X,Y) OR labels is EMPTY) ORDER BY LABELS ASC

Like Bruno De Mauro likes this

That helped a lot, thanks

Pete

Really saved my day thanks a lot☺

Thanks for your help smile This helped me with a query I was trying to get to work.

status in ("current sprint") AND (labels not in ("Tasking") OR labels is EMPTY)

Great works you both made my day!

Hi

tried this as well without sucess.

I got zero results back even if i have issues from that project without label = xy

I am using JIRA 5.2.1

Any more suggestions?

Try

project = A AND (labels NOT IN (xy) OR labels IS EMPTY)

It behaves like SQL's NULL, where any comparison involving NULL (except for IS NULL) is false.

Like Matt Tarris likes this

Hi,

How do i get all issues without a specifc label xy

the query

project = A AND not labels = xy

is not workiing

can anyone help?

Maybe try

project = A AND labels NOT IN (xy)

Suggest an answer

Log in or Sign up to answer