Using script runner, I want to use the java API to check if jira is currently being indexed and if so, i want to pause it temporarily. I know how to use the indexmanager class to start a new reindex process but I want to check if an index has begun outside of a given script.
Specifically, i have a scripted field that makes a jql search. The search throws an error during indexing. So i want to check if jira is being reindexed and pause it before the search.
That was my first thought but that only allows me to create a new indexer and start indexing. I dont see how to grab the current indexing process.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There must be JAVA API for this, just need to keep searching until you find it.
or, you can try to use this REST API:
https://docs.atlassian.com/software/jira/docs/api/REST/8.14.1/#api/2/reindex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is required a lot of digging and tests.
But basically, Reindex is a task, so you can use this JAVA API:
https://docs.atlassian.com/software/jira/docs/api/7.2.2/com/atlassian/jira/task/TaskManager.html
to search over all tasks and if there is a "reindex" running, and if yes then cancel it.
However, I think it's not a best practive to stop reindex process, specially not on regular basis, but it's your call.
I would wait for the reindex to stop and than continue what ever you want to do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How to get the indexing Task ID
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.task.TaskManagerImpl
def TaskManager = ComponentAccessor.getComponent(TaskManagerImpl)
def tasks = TaskManager.getLiveTasks()
for(key in tasks){
if (key.getDescription().contains("Indexing")){
return key.getTaskId()
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To skip field during indexing just "return null" instead of the index ID place it into the top of your scripted field to avoid it trying to use the SearchService for the JQL lookup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.