Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,555,911
Community Members
 
Community Events
184
Community Groups

High performance way to get all issue fields in Groovy (Scriptrunner Rest Endpoint)

Edited

We are an enterprise with a JIRA server (datacenter) instance. We are trying to use Scriptrunner's Rest Endpoint to do some performant queries (JQL) in Groovy rather than via the JIRA Rest API.

One of the things we need to do is to get various (typically many) fields of issues and its subtasks/issuelinks based on an initial query (JQL). Right now, we do the initial search (JQL query) to get a list of issues and then loop through the returned collection and then loop through the list of fields we care about. Attached code snippet below.

 

// psuedocode

SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch)

if (parseResult.isValid()) {
searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())

searchResult.issues.each { it ->
Issue issue = issueManager.getIssueObject(it.id)
def map = getIssueInfo(issue, fields)
}
}

// getIssueInfo method

def getIssueInfo(issue, fields) {
map = [:]
fields.each { fld ->
// Read get"fld" as getSummary, getAssignee etc.
map["fields"].put(fld, issue.get"fld"())
}
return map
}

We are seeing that the actual search is quite fast (200ms) but looping through each field takes about 10-15ms (sometimes more). If this time is going to be linear, as we process a larger list of issues, the time taken to get the fields goes up. Is there a better (quicker) way of doing this. I couldn't find a single method in the Groovy/Java API which would let me get a bunch of field values from an issue.

Appreciate any help!

1 answer

0 votes
Alejandro Suárez
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.
Sep 17, 2019 • edited

Hi @unmanifest the best possible way to achieve that is waht you have done, there is no way to get multiple values in one call, at least not with java api. You could try with the rest api, but is highly likely that response to be slower.

With the rest api you can get all the info for one single issue.

Check this out https://docs.atlassian.com/software/jira/docs/api/REST/8.4.1/#api/2/issue-getIssue

 

Edit: Maybe you can map it with the issue.getProperties() and get all the info, but is a pain to do all the research to get all you want.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events