JQL find all issues that have a custom property (no matter what content)

I want to find all issues via JQL that have a custom property set.
I am aware how to build searchable properties, but here I just want to find all issues that have the property, even when the property is empty.

Background: Finding all issues with a custom property (added by our add-on), check the content, and fix it (if it is empty or has an outdated structure.) So I cannot rely on searching “inside” the property!

Hi @SebastianK81,

My understanding of your scenario is that your field values conform to a schema and you want to upgrade the schema and any populated fields to conform to a new version of the schema.

I think you will have to iterate over all issues to upgrade their values, but if you anticipate needing to upgrade the schema again in the future, then you could introduce another field that identifies the schema version that the value of the first field conforms to. This additional schema version field could then be used to find only the issues with fields populated with values conforming to a specific version of the schema.

Regards,
Dugald

@dmorrow Thank you! So I assume there is no JQL and no way via REST to find all issues that have a particular property name?

Hi @SebastianK81,

When you say “find all issues that have a particular property name”, I’d like to clarify if you are referring to entity properties or custom fields. My first response was based on the assumption you are referring to custom fields. If you are referring to entity properties, you can define them so they are searchable with JQL as per https://developer.atlassian.com/cloud/jira/platform/jira-entity-properties/.

Regards,
Dugald

@dmorrow Sorry, that I was not clear enough. The question is not how to make a searchable property, but to find all issues who just have a property(no matter what content inside the property). Here is Pseudo-JQL I am thinking of:

issue.property[foo] = true
issue.hasProperty(foo)

Hi @SebastianK81,

When you use the term “property”, I think you are referring to entity properties that your app defines and makes searchable:

"keyConfigurations": [{
  "propertyKey" : "foo",
  "extractions" : [{
    "objectName" : "content",
    "type" : "text"
  }]
}]

There’s no JQL function relating to property existence. The functions are identified in https://support.atlassian.com/jira-core-cloud/docs/advanced-search-reference-jql-functions/.

I also don’t know of another syntax that would return all issues that the property exists on.

You could define an extra searchable entity property that is a boolean and set to true when your first entity property is set.

I hope this helps.

Dugald

I was looking exactly for this. Thank you for confirming there is no JQL for this.

This should work:

foo IS NOT EMPTY

Where foo is an alias for the property in question.

@kkercz Thank you. I tested it and it returns this error

Field 'myProperty' does not exist or you do not have permission to view it.

Here is one example issue with “myProperty” set.

And yes, JQL works on this property just fine. But we started without a searchable property and now need to cleanup the issues with the old non-searchable structure.

Well, you can’t search for the property itself by its key, only for extractions defined in the entity property module in your descriptor. What do entity property module definitions in your descriptor look like?

Thank you for re-confirming that we cannot search for properties itself by its key.

From my understanding an issue and its jiraEntityProperties (configured by atlassian-connect.json) are only refreshed in the search index when they are created or updated.
So even when I now add an extraction to find issues with the old property structure, the search would be empty as these issues are not indexed unless they are updated after adding the extraction, right?

Is there a way to trigger re-indexing of all issues in a cloud instance including jiraEntityProperties (configured by atlassian-connect.json)?

So even when I now add an extraction to find issues with the old property structure, the search would be empty as these issues are not indexed unless they are updated after adding the extraction, right?

No, if you add a new extraction everything will become searchable immediately.

My old non-searchable properties (that I need to fix and make searchable) look like that:

{
  "factSheets": [{"id": "a"},{"id":"b"}.{"id":"b"}]
}

I think there is no extraction possible on an array of objects. However, I tested following extractions:

                            {
                                "alias" : "factSheets",
                                "objectName" : "factSheets",
                                "type" : "string"
                            }
                            {
                                "alias" : "factSheets",
                                "objectName" : "factSheets",
                                "type" : "text"
                            }

As expected the JQL factSheets IS NOT EMPTY does not return any result.

Indeed, the problem is that extractions on arrays of objects are not possible.

I don’t know what it is you’re trying to do, but perhaps the Bulk set issue property API would be helpful? With it, you can e.g. set your property to something else only on issues that don’t have that property set to anything.

Perfect. With this I can add a searchable property value to all issues that have the property already. And then find them and cleanup. Thank you!

1 Like