I need to fetch the full change history by calling issue/{issue_key}/changelog. But first I need to know the issue keys whose history is longer than 100. Is there any jql in rest/api/3/search that I can easily fetch this information, or is there any other api that I can call to achieve this?

Is there a reason that you cannot just grab the data and parse it to find out?
I understand there may just be a huge amount of data, but if there is not it is the simplest way.

I will see if I can find an API call to assist further.

To give a bit background: we are using Airbyte to fetch the full issue dataset. With changelog expanded, it take 4-5 hours to fetch 400k records (since the maxResult on this search is 100 based on the data size)
To call the changelog api, I need to know issue keys first. I don’t want to go through the full issue dataset cause I’ll have to expand changelog in order to get that history count. I’ve done it, and it takes 8-9 hours in this case. If there is a simple jql in search api to do that, that will save us majority of the time.

it looks like you might be able to use expressions:

another thought is to create a custom field and using a trigger for the changelog, when it updates, you sum up the histories and put the number in the custom field.

I hope this helps in some way.

This is an interesting point. I took a look at it and syntax is a bit hard to understand.
I just have a simple case: I want to fetch all the issue keys with history longer than 100. What would be “expression” and “context” in my case?

To get started you may use the “Expression tester” App in the Marketplace. As JQL you can use something like “key in (xxxx, xxxxx, xxxxx)” and an expression like this:

issues.filter(issue => issue.changelogs.length > 100)
  .map(issue => { 
    key: issue.key,
    countChangeLogs: issue.changelogs.length

There is a limitation to access the changelogs property:
Issue Property Reference
The complexety is “N” and as a result you can’t query more than 10 issues using expressions. You may request atlassian to improve it to “len 1”, but I’m not sure about the request. It’s stated somewhere in the documentation

Thanks for your answer, Marcel.
This is getting complicated:

  1. I need to fetch changelog for all the issues with history longer than 100. With this “key in (xxxx, xxxxx, xxxxx)”, it may not work unless I can search across all the issues.
  2. Even in the search api, I have to pass in “&expand=changelog” in order to get changelog in issue data. That seems to be impossible in this eval api.
  3. As an alternative, we’ve requested an end point to Atlassian to achieve this faster.