Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner - Re-index Issues

Søren Hansen January 13, 2023

Hi

Questions regarding the Re-index Issues function in scriptrunner.

Can any of you explain to me exactly what a reindexing does and whether there are any risks associated with running it?

And how is it different from the function in JIRA:

Search indexing | Administering Jira applications Data Center and Server 9.5 | Atlassian Documentation

I have found the following explanation so far:

"A Jira index is a pile of local files Jira generates from the database.  They help it do most of its day-to-day work a lot faster than if it had to read the database for everything. 

The reindex function rebuilds a clean index from the database.  

So, there's no point backing up before reindexing.  If your reindex goes wrong, the absolute worst case is searches don't work, and the fix is to do a full reindex!"

 

2 answers

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2023

I think that looks like one of my old answers.

Scriptrunner does not actually do the re-indexing itself, it calls the re-index function in Jira for the list of issues you give it.  So it has the same risks as using the Jira re-index function.

A re-index is exactly what it says it is - it removes the old index data and creates a new set read from the issue data.  In a well-maintained Jira, you don't need to do it, because issues are re-indexed fully on every change, but things can go wrong that mean the index records go out of line with the database, and that's when you'll need to do it.

Søren Hansen January 15, 2023

Thank you very much. What is the best way for me to check that it is time for a re-index? Are there any native functions in JIRA i can use? 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 16, 2023

Depends on the type of indexing, but generally, it's simple - 

  • Have you changed field settings?
  • Have you got people reporting searches not working?
  • Have you just upgraded with the auto-index flag turned off?
Like Søren Hansen likes this
2 votes
Tuncay Senturk
Community Champion
January 15, 2023

Hi @Søren Hansen 

You can use Script Runner to run the re-indexing service of Jira. It uses the same service by code in order to reindex issues. There is no need to back up Jira if you want to reindex a few issues (which is background indexing).

On the other hand, if you have a large instance and want to start a full reindex, then it blocks the usage of Jira until it finishes. It is recommended to back up Jira before full reindex, because starting full reindex immediately deletes the existing index files and if unexpected problems occur, corrupted index files may impact the daily usage of Jira including searches (in particular).

I hope it makes sense!

Suggest an answer

Log in or Sign up to answer