Not working with Scriptrunner Scripted Fields
If I use Numeric (Stats) Searcher on a Scripted Field that returns and Int:
long createdDateTime = issue.created.getTime() long updatedDateTime = issue.updated.getTime()
if (updatedDateTime) {
return (updatedDateTime-createdDateTime)/(10006060*24) as int } else { return 0 as int }
Indexing fails with:
2016-06-21 10:49:20,489 JiraTaskExectionThread-14 WARN npn 636x730005x2 1cvz4r0 77.243.49.62 /secure/admin/jira/IndexReIndex.jspa [c.a.j.issue.index.DefaultIssueDocumentFactory] Error indexing issue SALG-2447: Dropped: [customfield_15121, customfield_15122, customfield_15124, customfield_15134, customfield_15136, customfield_15421, customfield_15422]
Comments (6)
-
reporter -
repo owner can you verify that your scripted field id is one of the reported dropped fields ? ie one of customfield_15121, customfield_15122, customfield_15124, customfield_15134, customfield_15136, customfield_15421, customfield_15422 ?
can you verify if a stacktrace is found in the log file , https://confluence.atlassian.com/jirakb/jira-indexing-operations-display-error-indexing-issue-dropping-custom-field-724766326.html?
-
repo owner - changed status to open
-
reporter Hi, its customfield_15421 (actually, I think all fields are Scriptet fields with the Numeric (Stats) searcher.
PS: Thanks for a good and usefull plugin - with an actually affordable price (thumbsup)
-
reporter Regarding the KB issue, I see no log except:
2016-06-21 12:36:08,628 Caesium-1-3 WARN anonymous Create/Comment Service - Support (Service Request) [c.a.j.issue.index.DefaultIssueDocumentFactory] Error indexing issue SUPPORT-14034: Dropping 'customfield_15122' 2016-06-21 12:36:08,629 Caesium-1-3 WARN anonymous Create/Comment Service - Support (Service Request) [c.a.j.issue.index.DefaultIssueDocumentFactory] Error indexing issue SUPPORT-14034: Dropping 'customfield_15134' 2016-06-21 12:36:08,629 Caesium-1-3 WARN anonymous Create/Comment Service - Support (Service Request) [c.a.j.issue.index.DefaultIssueDocumentFactory] Error indexing issue SUPPORT-14034: Dropped: [customfield_15121, customfield_15122, customfield_15124, customfield_15134, customfield_15136]
-
repo owner - changed status to resolved
Your script must return a Double
here is your script :
long updatedDateTime = issue.updated.getTime() if (updatedDateTime) { return Double.valueOf((updatedDateTime-issue.created.getTime())/(10006060*24) as int) } else { return 0 as Double }
you need to perform a reindex after you change your scripted fields
- Log in to comment
Complete Field Script:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.fields.CustomField import java.text.SimpleDateFormat
long createdDateTime = issue.created.getTime() long updatedDateTime = issue.updated.getTime()
if (updatedDateTime) {
return (updatedDateTime-createdDateTime)/(10006060*24) as int } else { return 0 as int }