JQL Query for Issue property containing array

I’m populating Jira Entity properties (issues) with Jira’s API and I have a forge app to help index the fields so they are searchable.

Submitting a request:


curl -X PUT -H "Content-type: application/json" https://thatapp.atlassian.net/rest/api/3/issue/TEST-01/properties/deployments -d '{"tag":"v0.0.1","date":"2023-05-26", "repo" : "GH", "environment" : "production"}'

Using a forge APP configured as:


modules:
  jira:entityProperty:
    - key: "jira-issue-deploymentlist-indexing"
      entityType: "issue"
      propertyKey: deployments
      values:
        - path: tag
          type: text
          searchAlias: deploymentTag
        - path: date
          type: date
          searchAlias: deploymentDate
        - path: environment
          type: text
          searchAlias: deploymentEnvironment
        - path: repo
          type: text
          searchAlias: deploymentRepo
app:
  id: ari:cloud:ecosystem::app/test

And using the following TQL:
deploymentRepo~"GH"

Works!

The problems is that I plan to store multiple “deployments” into that property so the payload will look like:

curl -X PUT -H "Content-type: application/json" https://thatapp.atlassian.net/rest/api/3/issue/TEST-01/properties/deployments -d '[{"tag":"v0.0.1","date":"2023-05-26", "repo" : "GH", "environment" : "production"}]'

OR

curl -X PUT -H "Content-type: application/json" https://thatapp.atlassian.net/rest/api/3/issue/TEST-01/properties/deployments -d '[{"tag":"v0.0.1","date":"2023-05-26", "repo" : "GH", "environment" : "production"}, {"tag":"v0.0.2","date":"2023-05-26", "repo" : "GH", "environment" : "production"} ]'

How can I query this data using JQL?

my first guess was using something as
issue.property[deployments]["*"].repo~"GH"

No luck!
This is just one scenario, but being able to query this data will unlock other use cases for me.

Thanks you!

Hi, did you find some solution of it or still not ?

Hello @SMA

AFAIK, it’s not possible, since JQL cannot do recursive searching, so it can’t find a match within a set of properties (an array of properties) that are within a property.

You can use JQL to find all the issues where the top level property has a particular value, then make separate API calls using the Get Issue properties endpoint for each of those issues to get the array of properties within the top level property, which you’ll then have to parse and filter in your app.

Hi @sunnyape thanks for the reply, I got your point but how to get the searchable string and populate the issue search bar in forge module? like is there any method which i call inside jira:entityProperty and populate the results myself ?

Forge jira:entityProperty