Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-61325

Add 'Schedule Re-index' button for scheduling it to an appropriate date and time

    • 15
    • 15
    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      Problem Definition

      As a JIRA Administrator, I would like to be able to manually schedule a one-time 'Lock JIRA and rebuild index' action, so that it can take place without blocking users at a time when they might be still working on JIRA, and without requiring me to actually click the Re-Index button at such an inconvenient time.

      Suggested Solution

      Workaround

      Trigger Full reindex using REST API and schedule it use Cron job.

            [JRASERVER-61325] Add 'Schedule Re-index' button for scheduling it to an appropriate date and time

            Vibin added a comment -

            This Would be useful.

            Vibin added a comment - This Would be useful.

            Henry Lin added a comment -

            thanks, @Timony!

            Henry Lin added a comment - thanks, @Timony!

            Timothy McClain added a comment - - edited

            @Henry Lin

            It's fairly basic but here it is.
            The rest call is made over 8080 as opposed to the secured port because I kept getting SSL errors and couldnt be bothered. as for the authstring, you need to literally convert username:password to base64 and use that. There may be other 'more secure' ways to auth, but this has worked for all rest calls I've needed to make. I run this as a daily job, but obviously you can set it to as frequently as you need it to.
             
            String authString = "your base64 encoded username:password"
             
            String url = "server-url:8080/rest/api/2/reindex?type=FOREGROUND"
             
            def post = (HttpURLConnection) new URL(url).openConnection();
            post.addRequestProperty("Authorization", "Basic "+authString);
            post.setRequestMethod("POST");
            post.connect();
             
            int status = post.getResponseCode();
             
            switch (status)

            {     case 200:     case 202:         log.warn("Reindex Started.")         break;     case 404:         log.warn("404 Error received.")         break;     default:         return "Unsuccessful" }

               
            return "Great Success"

            Timothy McClain added a comment - - edited @Henry Lin It's fairly basic but here it is. The rest call is made over 8080 as opposed to the secured port because I kept getting SSL errors and couldnt be bothered. as for the authstring, you need to literally convert username:password to base64 and use that. There may be other 'more secure' ways to auth, but this has worked for all rest calls I've needed to make. I run this as a daily job, but obviously you can set it to as frequently as you need it to.   String authString = " your base64 encoded username:password "   String url = " server-url :8080/rest/api/2/reindex?type=FOREGROUND"   def post = (HttpURLConnection) new URL(url).openConnection(); post.addRequestProperty("Authorization", "Basic "+authString); post.setRequestMethod("POST"); post.connect();   int status = post.getResponseCode();   switch (status) {     case 200:     case 202:         log.warn("Reindex Started.")         break;     case 404:         log.warn("404 Error received.")         break;     default:         return "Unsuccessful" }     return "Great Success"

            Henry Lin added a comment -

            @Timothy McClain, do you mind share your Scriptrunner script/repo? 

            Henry Lin added a comment - @Timothy McClain, do you mind share your Scriptrunner script/repo? 

            For those interested that use Scriptrunner, I have a job script that performs this function.

            Timothy McClain added a comment - For those interested that use Scriptrunner, I have a job script that performs this function.

            SKanagala added a comment -

            It is very helpful feature for admins.

            SKanagala added a comment - It is very helpful feature for admins.

            That is time saving!

            Job Wolters added a comment - That is time saving!

            Very interested in this functionality.

            Timothy McClain added a comment - Very interested in this functionality.

            This would be a great enhancement to have.

             

            Christie Leone added a comment - This would be a great enhancement to have.  

            Derek Mart added a comment -

            Why isn't this already a thing for such a seasoned application that requires reindexing every time you make any number of changes?

            Derek Mart added a comment - Why isn't this already a thing for such a seasoned application that requires reindexing every time you make any number of changes?

              Unassigned Unassigned
              5c52af3a81d4 Ignacio Pulgar
              Votes:
              259 Vote for this issue
              Watchers:
              121 Start watching this issue

                Created:
                Updated: