ScriptRunner scripted field's value does not seem to be reindexed

I have an issue with ScriptRunner’s scripted fields. I have one field that is a text field. It check the status of specific issues linked to it, does some basic crunching and reports a result in that text scripted field.

I am able to do a JQL search based on that scripted field’s value. However, if I change the status of one of the linked, it changes the value of the scripted field correctly, but I am not able to find it with the new value, oly the old one, unless I reindex all the issues.


My scripted field value is “ALL DONE”

I search issues with the JQL: “My script” = “ALL DONE”

It returns my issue with the ALL DONE value. Good!

I change something, the scripted field’s value changes to “Oh oh!”.

I search issues with the JQL: “My script” = “Oh oh!”

It find nothing…

I search issues with the JQL: “My script” = “ALL DONE”

It return my issue from before, with the scripted field’s value “Oh oh!”…

I tried adding enableCache = {-> false} to my scripted field, but it didn’t do anything…

The problem is that if your field calculates its value using information from other issues, then reindexing of the current issue does not happen. It is a limitation. It is your case. If the linked issue is changed, the reindex of the linked issue does not happen. You can either do the full reindex or upon changing the status of the linked issue, reindex the required issue.

So I could add a piece of code at the end of my scripted field that indexes the issues linked to that one using the IssueIndexingService?

The search works before the field is queried. That is why you should add reindexing, when you change the status of the linked issue.

1 Like