Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I query more than 1000 results for JIRA?

I'm using the Logstash Input Plugin exec to run a command periodically to get JIRA data. Even if I set maxResults=99999, only 1000 results are returned. Here is my code right now:

input {
    exec {
        command => "curl -u username:password https://mycompany.atlassian.net/rest/api/latest/search?project=project&maxResults=8500"
        interval => 300
        type => "issues"
    }


} output {  
    elasticsearch {
        hosts => "localhost:9200"
        index => "jira"
    }
}

I found online that if you run around 10 execs, and you set startAt to 0, 1000, 2000, etc, you get around 10000 responses. Is this faster than just one exec that pulls 8000 requests? How do I return more than 1000 responses with 1 exec?

like image 436
Sidharth Rampally Avatar asked Jan 20 '26 19:01

Sidharth Rampally


2 Answers

@alpert's answer is correct, but I'll add a bit more detail.

JIRA's REST API (and most rest api's in general) support pagination to prevent that clients of the API can put too much load on the application. This means you cannot just pull in all issue data with 1 REST call.

You can only retrieve "pages" of max 1000 issues using the paging query parameters startAt and maxResults. See the Pagination section here.

If you run a JIRA standalone server then you can tweak the maximum number of results that JIRA returns, but for a cloud instance this is not possible. See this KB article for more info.

Your logstash configuration shows that you're periodically dumping all JIRA issues of a project into ElasticSearch. There are probably better ways to achieve what you're trying to do, than to use the JIRA GET /issue REST API call. So what do you use that data in ElasticSearch for?

Possibly there is a way to do what you need within JIRA, or you could look for a more convenient way to export all JIRA data, e.g. by using the export functionality.

like image 142
GlennV Avatar answered Jan 24 '26 23:01

GlennV


Taken from :https://confluence.atlassian.com/jirakb/changing-maxresults-parameter-for-jira-rest-api-779160706.html

Unfortunately it is not possible to change this value as it falls under customizations which are not allowed in Atlassian Cloud.

It seems the best way is to use startAt aproach.

like image 45
alpert Avatar answered Jan 25 '26 00:01

alpert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!