I have created a Calculated number field that calculates the number of working days since the issue is last updated. The field works well but the issue is that to be able to search that field, the issues must be indexed. Normally an issue is indexed at any update over it but in my case there will be no updates. So the field won't be searchable until you perform a manual re-indexing. Is there is a way to enforce the indexing of an issue when the field is calculated? Or there is a better way to search for issues that are not updated since more than 3 working days?
>but in my case there will be no updates.
That stands out to me as being wrong. Why will there be no updates? What is your field calculating? If there's no updates to the issue, then it suggests you're calculating from dynamic or non-JIRA data, which means a scripted field is not the right approach.
Hi @Nic Brough [Adaptavist],
The field is calculating the number of working days since the last updated date.
When I search for this field in JQL(e.g. "field">3) it doesn't return a value but the value is there. After I perform an indexing the issues are retrieved through the JQL query.
Ok, that makes sense.
The problem here is that you've defined a data item that is not static. Think of it this way - when should the field be calculated? The underlying information of "time since x" is variable - it's a different answer now from what it was when I first answered, when I got up and read the response, when I started typing. JIRA stores time data in milliseconds, so that's the highest granularity you could use and means you could really be asking to index the field 1000 times a second. In real life, you've probably got a granularity of an hour or a day or something more sane, but the problem is the same - you're going to need to calculate and re-index your entire system on every "grain" of time.
@Nic Brough [Adaptavist], my problem is not with the display. The field is displayed correctly whenever I check the request but my problem is with being able to query it. Before the indexing the value is considered as null but you can see the value of the field which is correct.
I think you've missed the point. Your design is broken because your search is for a value that changes 1,000 times a second. Storing "elapsed time" in the scripted field is inaccurate even before the write cycle is finished.
What you need to do is re-phrase the search in useful terms. For example, instead of "time elapsed since update is over seven days", use "updated more than seven days ago". When you rewrite the question with the dynamic value being "now" instead of "elapsed time", the problem goes away.
I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG