Automatic jira reindex

Hey  guys,

It is possible to schedule a JIRA reindex or write a script to do this?

Thanks!

1 answer

1 accepted

Mihai,

First of all perform reindex only when you have to. There is no need to do it regularly.

You can trigger reindex from REST API: https://docs.atlassian.com/jira/REST/server/#api/2/reindex-reindex

-Ravi

It's always worth questioning why you want to do this.  There are some cases where it makes sense, but if you're doing it because your index is regularly going wrong, then this is absolutely the wrong thing to do. 

There's a phrase "plastering over the cracks" - when your house is structurally unsound, cracks appear in the plaster as it gradually falls apart.  If you "plaster over the cracks", your house might look ok to the eye, but you're hiding the fact that it's going to fall down soon.

So, if you're doing this because you're getting indexing errors a lot, you need to fix that, not pretend you don't have a massive problem.

@Ravi Sagar [Author - Mastering JIRA 7] Thanks for the answer!

@Nic Brough [Adaptavist] Yes, I agree with you, but I need to reindex after working hours because I make a lot of change during the day (fields, addons, etc) and I don't wanna manual reindex every time.

Ok, but that's just a case of clicking it when you know you've finished your changes, exactly as Ravi said.  The REST call does that

You do not need or want to do it regularly.

 

We are undoubtedly in a position of having to do this weekly, and for performance and other organizational reasons it has to be hard reindexing each Saturday night at midnight. We are pushing our little VM to the limit and I lack the cash and authority to move to dedicated hardware at this time so...

I would rather not have to logon every Saturday night to start this hard reindex. We do have ScriptRunner if that helps, and I can schedule cron jobs.

Why?  Are you really re-configuring your fields every week?

Because at least some of our over a thousand project admins need changes.

Our little group supports them, they in turn support over 600 teams. In any given week there will be at least a few tweaks that are not easily isolated to the project, notwithstanding scope control of custom fields in the default field contexts.

Anyhow, I found a crude approach, though would rather handle authentication otherwise. With this I may have to regularly change the password for some admin account, cron it up late each week. The account under which JIRA runs is pretty restricted, but storing plaintext passwords is not a good thing - I have the same concern re dbconfig.cfg, by the way. Here's what I tested last night in nonprod:

curl -u [acct]:[password-of-week] -X POST https://[JIRA instance]/rest/api/2/reindex?type=FOREGROUND

We may find a better way, using centrally-controlled automation, but this works. From https://confluence.atlassian.com/jirakb/how-to-trigger-re-indexing-using-rest-request-via-curl-command-663617587.html.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

81 views 0 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you