1. Go to JIRA > Add-ons > Script Runner > Script Console
  2. Copy the script contents, replace “PUT_KEY_OF_ISSUE” and press Run

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.index.IndexException
import com.atlassian.jira.ManagerFactory
ComponentManager componentManager = ComponentManager.getInstance();
ProjectManager projectManager = componentManager.getProjectManager();
IssueManager issueManager = componentManager.getIssueManager();
issueobtained = issueManager.getIssueObject("PUT_KEY_OF_ISSUE");
ManagerFactory.getIndexManager().reIndex(issueobtained.getGenericValue());

This code correct problems with issues that don’t shows the status correct in views, etc.

Posted by:.

2 replies on “Issue Index Corrupted / Reindexing by Groovy ScriptRunner

  1. New code for Jira 7

    import com.atlassian.jira.component.ComponentAccessor
    import com.atlassian.jira.project.ProjectManager
    import com.atlassian.jira.issue.IssueManager
    import com.atlassian.jira.issue.index.IndexException
    import com.atlassian.jira.ManagerFactory
    import com.atlassian.jira.issue.index.*;
    
    ProjectManager projectManager = ComponentAccessor.getProjectManager();
    IssueManager issueManager = ComponentAccessor.getIssueManager();
    def issueobtained = issueManager.getIssueObject("ISSUE_TO_REINDEX");
    def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService)
    issueIndexingService.reIndex(issueobtained);
    

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s