'Start jira re-indexing. Returns True if reindexing is in progress or not needed, or False.
If you call reindex() without any parameters it will perform a backfround reindex only if JIRA thinks it should do it.
:param force: reindex even if JIRA doesn\'tt say this is needed, False by default.
:param background: reindex inde background, slower but does not impact the users, defaults to True.'

def reindex(self, force=False, background=True):

    if background:
        indexingStrategy = u'background'
    else:
        indexingStrategy = u'stoptheworld'
    url = (self._options[u'server'] + u'/secure/admin/jira/IndexReIndex.jspa')
    r = self._session.get(url, headers=self._options[u'headers'])
    if (r.status_code == 503):
        return 503
    if ((not r.text.find(u'To    perform    the    re-index    now,    please    go    to    the')) and (force is False)):
        return True
    if r.text.find(u'All    issues    are    being    re-indexed'):
        logging.warning(u'JIRA    re-indexing    is    already    running.')
        return True
    if (r.text.find(u'To    perform    the    re-index    now,    please    go    to    the') or force):
        r = self._session.post(url, headers=self._options[u'headers'], params={u'indexingStrategy': indexingStrategy, u'reindex': u'Re-Index'})
        if (r.text.find(u'All    issues    are    being    re-indexed') != (-1)):
            return True
        else:
            logging.error(u'Failed    to    reindex    jira,    probably    a    bug.')
            return False
