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

Steve Slesinger June 5, 2012

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

95 votes
Answer accepted
Miroslav Atanasov November 6, 2012

had the same problem, solved it this way:

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

Hieu Le Trung October 25, 2013

It works for me. Thanks,

Like # people like this
Tim van Cann February 5, 2014

Works perfectly

Joshua Wold March 12, 2014

Worked! Thanks.

Brendan Andrews July 14, 2014

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
Błażej O_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2014

You saved my day :)

Aneece Yazdani May 8, 2015

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!

Tim Enloe August 26, 2015

Perfect, just what I was looking for.

Barry Gausden October 1, 2015

Nice. Many thanks.

Mike McGowan August 9, 2016

Words cannot express my thanks!

Mahender Reddy Yasa February 16, 2017

Really saved my day thanks a lot🙂

Jennifer Zou May 9, 2017

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

Tom Vian July 6, 2017

Nice.  thanks

boardtc
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 24, 2017

Brilliant!

Flying High December 7, 2017

Top stuff.  Thanks Miroslav

Amir Weiss April 7, 2018

Thanks!

Karin Schütt July 2, 2018

Great help. Thanks

Melissa Canterbury January 18, 2019

THANK YOU!!!!!!

martin.delgado@pedidosya.com March 19, 2019

Big help here

Siddhant Luthra August 19, 2019

Awesome!

Thank you

david_jerabek September 3, 2019

Thanks, works fine :) 

Casey Cantwell November 1, 2019

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

Like Italo _Modus Create_ likes this
Santiago Leon December 4, 2019

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

Gustavo Sant 'Anna December 27, 2019

It worked ! thanks a lot !

Jens Niedrich May 15, 2020

Saved my day - thanks!!

Samir Koirala July 13, 2022

Great answers.

13 votes
nigeljohnson73 March 6, 2015

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 October 7, 2015

Nice !

Like Arumugam Raman likes this
Heather Laurence April 25, 2016

You are my hero! 

kathleen Walsh December 19, 2017

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
Undead2k August 28, 2018

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

Jenny Severin June 5, 2019

Thank you.  This helped me with my issue!  

Andras Ujfalusi December 6, 2019

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
guilherme March 24, 2020

Saved my life! Thank you!

Jeppe Dam Sørensen April 22, 2020

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. 

Rade Knezevic October 12, 2020

Thanks in 2020 one more time :)

Marius Kurseth July 7, 2022

Still relevant in 2022, thanks alot!

2 votes
thomas tulinsky May 27, 2013

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.

1 vote
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2012

Try

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

Steve Slesinger June 6, 2012

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

Steve Slesinger June 6, 2012

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

Steve Slesinger June 6, 2012

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.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2012

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?

Steve Slesinger June 6, 2012

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

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2012

I would raise the issue with Atlassian support.

Steve Slesinger June 6, 2012

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

Steve Slesinger June 6, 2012

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.

0 votes
Ian Tait December 12, 2019

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"?

0 votes
Brian Mackey July 22, 2019

Actually for me this worked:


labels not in (DEMO) OR labels is EMPTY

 

The OR clause is critical

0 votes
Jordi Federico August 9, 2018

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.

Tim McGrath November 27, 2018

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
0 votes
Pete Jones August 8, 2018

That helped a lot, thanks

Pete

0 votes
Mahender Reddy Yasa February 16, 2017

Really saved my day thanks a lot☺

0 votes
Nithya Priyaa Bommannan January 15, 2016

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)

0 votes
Alexander Fedtke June 20, 2013

Great works you both made my day!

0 votes
Nitram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2013

Hi

Check this, may be usefull for you,

https://answers.atlassian.com/questions/73065/labels-does-not-contain-is-not-working

Hope this helps.

0 votes
Alexander Fedtke June 20, 2013

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?

Michael Knight
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2013

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
0 votes
Alexander Fedtke June 19, 2013

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?

Michael Knight
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2013

Maybe try

project = A AND labels NOT IN (xy)

Suggest an answer

Log in or Sign up to answer