If you introduce a new scripted field, you cannot use it in a meaningful way in a JQL search because for existing issues the value will not be calculated until you watch the issue in the browser.
Therefore it would be helpful to initiate the calculation of the scripted field values for all existing issues.
It looks like that the enhancer plugin have some kind of such a function (not tested on my own): https://confluence.snapbytes.com/jira-enhancer/cloud/recalculate-custom-field-values-for-existing-issues
This used to work on srever, please implement it on cloud too.