How can I find issues with a label NOT in a specified list?

We are trying to clean up the labels used on a project; I would like to find a way to see a list of issues that have a label that is NOT in a set of labels that I specify.

For example, I want to find all issues that have any label that is not one or more of (foo, bar). Some issues might have 2 labels, such as (foo, zing). I need to find all issues that contains any label that is not foo or bar.

2 answers

This widget could not be displayed.
Alexey Matveev Community Champion Dec 01, 2017

Hello,

You would need to write a JQL like that

labels not in (foo,zing)

Thanks, tried that, but it doesn't work. In your example, it wouldn't find an issue with (foo, zing), since its "foo" label matches--it is in (foo, zing).

This widget could not be displayed.

I think you'll need to name the list explicitly, one clause at a time.

labels != foo AND labels != zing AND labels != bar AND ....

Thanks, but that doesn't work either. In this case, it won't find an issue with (foo, zing) because the labels comparison, apparently, matches ANY label on a task. Here, if I want to find any issue with zing, but filter on (labels != foo AND labels != bar), an issue containing foo will cause the AND construct to return FALSE. (By Jira's behavior, labels does = foo.)

Hang on, that's not what you asked for.

"I want to find all issues that have any label that is not one or more of (foo, bar)"

The search "label != foo and label != bar" will exclude those, and all you need to do then is add "and label is not empty".  That will answer the question presented.

Or is the original question not quite right?

Thanks for circling back, but I'm not quite sure how else to frame the question.

At a high level, I want to find a list of issues that contain any label not in a list of "approved" labels. In my example, I want to find any issue that contains any label other than "foo" or "bar", but I won't know what "unapproved" labels someone might have entered. If someone applied the "zing" label, I need to find it. (Logically, I need to express "issue has any_label NOT one of [foo, bar]".)

With your suggested test, it won't find (foo, zing), since it will fail the "label != foo" comparison.

Does this clarification help?

Ah, yes, I think it explains what I was not getting.

You don't care if foo or bar are on the issue, you want to find issues that have a label other than foo or bar.

In Jira terms, the starting point is "labels is not empty".  But then you want to exclude issues where the labels are only foo, bar or foo and bar.

I can't think of a neat way to to that, because the logic of "not" means you get "not <statement>" not "not <isolated statement>"

Yup, that's it.

I'm beginning to suspect what I want to accomplish isn't possible using JQL.

Someone suggested doing an export of the issue list, and running a script over that, to find the issues that contain "unapproved" labels. That's my last resort. If anyone else has any other outside-the-box solutions for my use case, that would be most appreciated.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

172 views 1 3
Join discussion

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