You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


A console script for displaying the fields on the Lucene document for an issue


Searching in Jira is done using Lucene. Each time an issue is edited, or you do a full or project reindex, the Lucene index is updated. Each issue is represented by a Lucene document.

It is the responsibility of indexers to contribute to the document representing the issue. When executing a JQL query, various searchers will build a Lucene query to interrogate the index.

This script can be useful to help diagnose any problems with either indexers or searchers.

To use it, enter the key of the issue you wish to see the document for.


  • Jira Jira (8.0 - 8.19)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.index.DocumentConstants import import com.onresolve.scriptrunner.canned.util.OutputFormatter import com.onresolve.scriptrunner.parameters.annotation.ShortTextInput import org.apache.lucene.index.Term import import import def searchProviderFactory = ComponentAccessor.getComponent(SearchProviderFactory) def indexSearcher = searchProviderFactory.getSearcher(SearchProviderFactory.ISSUE_INDEX) def issueManager = ComponentAccessor.issueManager @ShortTextInput(label = 'Issue Key', description = 'Enter an issue key to view the Lucene document') String issueKey assert issueKey // Please enter an issue key def issue = issueManager.getIssueObject(issueKey) assert issue // Could not find an issue with this key def bq = new BooleanQuery.Builder() .add(new TermQuery(new Term(DocumentConstants.ISSUE_ID,, BooleanClause.Occur.MUST) .build() def docId =, 1).scoreDocs.first().doc def document = indexSearcher.doc(docId) OutputFormatter.markupBuilder { table(class: 'aui') { thead { tr { td('Name') td('Value') } } document.fields.sort(false) { }.each { field -> tbody { tr { td( td(field.stringValue()) } } } } }
Discovered an issue? Report it here

Suggested for you