JQL Query does not return expected results

Eren Erdem October 22, 2024

Hey, I am trying to fetch all worklogs within a date range. Since I think that it is natively not possible to do that, my process was to fetch issues and then its corresponding worklogs.

However, the search endpoint: /rest/api/2/search with the following body does not return the result I expected. 

Body =  

 

{
  "jql": "worklogDate >= 2024-06-01 AND worklogDate <= 2024-06-30
  "fields": ["worklog"]
}


It returns 48 out of the expected 49 issues. I have looked into the missing issue, and for me, it does seem like the condition is absolutely satisfied. Here is an example output of those worklogs: (total 1029 Worklogs)

Worklog: StartDate 06/10/2024 08:00:00, UpdatedDate: 07/01/2024 11:41:24, CreatedDate: 07/01/2024 11:41:20

The value of "StartDate" differs in every worklog (which is kind of obvious), but the UpdatedDate and CreatedDate are almost every time the start of the next month (also intended). The confusing part here is that every other issue is being returned, regardless of the difference in the months of StartDate and the other dates. It is just this one single issue which will not be returned. The problem might also not be the date itself, I am not sure.

As an example, another issue with the following data is being returned, using the exact same jql query.


 

Worklog: StartDate 06/24/2024 08:00:00, UpdatedDate: 07/01/2024 11:47:31, CreatedDate: 07/01/2024 11:47:31

 

I know that this endpoint returns all the issues, where a single worklog within the issue satisfies the condition, which means I will get worklogs even though they do not match the condition. But I still think that given those specific worklogs, the missing issue should be returned..

 

Am I missing something?

2 answers

0 votes
Georg Fuetsch
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 30, 2024

most likely, the issue is that Jira doesn't index an unlimited number of worklogs: https://community.atlassian.com/t5/Data-Center-articles/Introducing-Safeguards-for-Jira-index/ba-p/2037880#M433

0 votes
Salih Tuç
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.
October 22, 2024

Hi @Eren Erdem welcome to the Community!

First of all, change your jql as following, in order not to miss the worklogs on end date:

worklogDate >= 2024-06-01 AND worklogDate < 2024-07-01

And for the dates:

  • StartDate: The work date, the date that you enter during "Log Work" screen.
  • CreatedDate: The date that you enter the worklog.
  • UpdatedDate: The date that worklog edited, if it is not edited, it is same with createdDate.

So, when you are searching through worklogDate, it is looking at the StartDate for the worklog.

 

With this knowledge, I think your approach is correct. So, can you please share some more details about your setup:

  • Can you able to see all these 49 issues from account that you connect to REST when you try "Issue Search" on Jira?
  • Can you share some details about worklogs in the invisible issue?
  • Are you sure there are 49 issues? :)

 

Eren Erdem October 22, 2024

Thank you for the quick reply.

As for the questions:

I do see every issue that I want to request in the UI when I am logged in. In fact, all 155 worklogs, at which the month of the start date is equal to June (the month the jql query requests filters) are available. 

I am 100% positive about 49 issues.

Worklogs which ARE in the response:

[13:37:31 INF] Jira key: "GJT-8361", Worklogs: 4
[13:37:31 INF] Worklog: 06/04/2024 08:00:00
[13:37:31 INF] Worklog: 06/05/2024 08:00:00
[13:37:31 INF] Worklog: 06/06/2024 08:00:00
[13:37:31 INF] Worklog: 06/07/2024 08:00:00

 

Worklogs in the missing / invisible issue:

[13:41:59 INF] Jira key: "NIT-2316", Worklogs: 155
[13:41:59 INF] Worklog: StartDate 06/03/2024 08:00:00
...
[13:41:59 INF] Worklog: StartDate 06/03/2024 08:00:00
[13:41:59 INF] Worklog: StartDate 06/04/2024 08:00:00
[13:41:59 INF] Worklog: StartDate 06/04/2024 08:00:00
[13:41:59 INF] Worklog: StartDate 06/05/2024 08:00:00
[13:41:59 INF] Worklog: StartDate 06/05/2024 08:00:00
...
[13:41:59 INF] Worklog: StartDate 06/10/2024 08:00:00
[13:41:59 INF] Worklog: StartDate 06/14/2024 08:00:00
[13:41:59 INF] Worklog: StartDate 06/24/2024 08:00:00
...
[13:41:59 INF] Worklog: StartDate 06/28/2024 08:00:00
....

155 worklogs instead of the 1k+ because I filter them once more AFTER I fetch them, since I want to have the actual worklogs within the date range, and not every worklog in the issue (i elaborated that above)

Yeah, again, I do not see a problem here...

EDIT: 

 

One more thing: If I request issues a month later (for July), I DO get the missing issue, since it has worklogs where the StartDate fits within the date range, but so should it do in June, but it doesn't.

Eren Erdem October 22, 2024

I now found out that the endpoint does not return the issue up until June 2024, after June, it returns the issue. So no issue in January, February, ... although the issue contains data where the StartDate satisfies the date range.

Suggest an answer

Log in or Sign up to answer