Get inconsistent JIRA issues returned when using REST API

Shuai Wang March 4, 2024

Hi there,

 

I'm trying to use REST API to get all the JIRA issues for the Hive projects but got inconsistent results with two REST API requests.

The first one is to get ALL the JIRA issues from Hive projects:

https://issues.apache.org/jira/rest/api/2/search?jql=project=Hive

The second one is to get the Hive JIRA issues that contains `Zookeeper` keyword:

https://issues.apache.org/jira/rest/api/2/search?jql=project=Hive+and+(summary~'Zookeeper'+or+description~'Zookeeper')

However, I found that some issues from the second request are not included in the first one. Shouldn't the first one return ALL the JIRA issues and include all the issues from the second one?

Is there any mistake I made that caused this to happen?

 

One inconsistent example is issue `HIVE-23715`, which is returned by the second request but not the first one.

1 answer

1 accepted

1 vote
Answer accepted
Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 4, 2024

Hi @Shuai Wang

I think the queries are OK but keep in mind these return paged results. By default you will only get 50 results at once.

Any chance you are only looking at the first 50?

Look at the beginning of your response:

{"expand":"schema,names","startAt":0,"maxResults":50,"total":27985

You can set the maxResults parameter to another number or use the startAt parameter to go through the different pages.

https://issues.apache.org/jira/rest/api/2/search?maxResults=2000&jql=project=Hive

 

Shuai Wang March 4, 2024

Hi @Charlie Misonne 

Thank you so much for your reply.

I've tried to set the maxResults with a larger number, 5000, for both requests.

https://issues.apache.org/jira/rest/api/2/search?startAt=0&maxResults=5000&jql=project=Hive

The beginning of the new response is like this:

{"expand": "schema,names","startAt": 0,"maxResults": 1000,"total": 27985

But the `HIVE-23715` is still not there. Is there anything else I missed?

Is this `maxResults (1000)` a subset of `total (27985)`? Also why it returned `1000` when I set the `maxResults` to 5000?

Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 4, 2024

Hi!

There is a hard total of 1000 max results and you can not override it yourself. So you'll need to use the startAt=1000 parameter to get the next 1000 results.

Or you can get creative and sort the results by key in descending mode to get your HIVE-23715 earlier.

 

Shuai Wang March 4, 2024

Oh, I see. Thank you for your explanation!

Charlie Misonne
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 5, 2024

You are welcome!

Suggest an answer

Log in or Sign up to answer