JQL Ordering by searchable entity property

Hi,
I have an entity property of type number with an alias ‘myEntityProperty’.

The following JQL fails:
order by myEntityProperty

If I add “asc” or “desc” at the end of the query, the JQL works fine. Standard Jira fields that support ordering don’t required the explicit sort order.

Atlassian Support suggested that a default ordering can be specified for entity properties. Is anyone aware of how to specify it?

Hi @daniel2,
it took us a while to reply to your question, however I hope you find my response useful.

To make entity properties searchable you need to follow Making searchable entity properties section.

I have tested and it works for me.
I have my issue property called myEp and it’s content is:

{
    "beataIsSuper" : 10
}

I have added this module to my app-descriptor and reinstalled my app.

    "jiraEntityProperties": [{
      "key": "jira-issue-tasklist-indexing",
      "name": {
        "value" :"Tasks index",
        "i18n": "tasks.index"
      },
      "entityType": "issue",
      "keyConfigurations": [{
        "propertyKey" : "myEp",
        "extractions" : [{
          "objectName" : "beataIsSuper",
          "type" : "number"
        }]
      }]
    }]

Than I was able to query like that:
issue.property[myEp].beataIsSuper>0 order by issue.property[myEp].beataIsSuper DESC


Hope it helps.
Enjoy your weekend.

Hi Beata,

Please note in my post:

If I add “asc” or “desc” at the end of the query, the JQL works fine. Standard Jira fields that support ordering don’t required the explicit sort order.

If you remove the DESC from your query I’m pretty sure Jira will complain with a server error which seem to be a Jira bug.

Sorry, my bad. I haven’t read your question carefully.
I will take a look at it next week.

1 Like

Hi @daniel2,

unfortunately I have confirmed that the behaviour you pointed out is a Jira bug. I created a ticket to track it yesterday. I suppose that resolving it will apply some default ordering on entity properties. If you believe that possibility of defining a default order for every entity property/extraction can be valuable from vendor perspective, you should create some ACJIRA ticket.

1 Like