How to use Jira's index analyzer to fix index inconsistencies

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

In Jira 8.4, the index analyzer endpoint (/rest/indexanalyzer/1/state?maxResults=XXXX implemented in JRASERVER-69942 - As an JIRA Administrator I want check Lucene Index and Issues consistency) can bring us the issues in the following states:

  • Index orphan - issue present only in index, should be removed

  • DB orphan - issue present only in database, should be added to index

  • Outdated issue - if issue in index is not the same as in database

  • OK issue - if issues is the same in index and database

  • Archived issue - if issue is archived

In later versions, a healing endpoint (/rest/indexanalyzer/1/heal) was introduced, so we can fix the issues automatically: JRASERVER-76343 - Extend index analyzer with index fixing capability

ℹ️ The indexanalyzer endpoint runs a per-node index analysis/fix. For full analysis or healing results, the endpoint should be called in each node.

Environment

Jira 9.12.0, 9.11.1, 8.20.27, 9.4.11

Diagnosis

As an example, let's suppose a Jira node has:

  • One issue missing from the index (DB orphan)

  • One deleted issue present only in the index/searches (index orphan)

  • One outdated issue.

If we call the index analyzer endpoint (/rest/indexanalyzer/1/state?maxResults=10), we'll get a result like this:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 { "indexOrphans": [ { "issueId": 10101, "lastUpdated": 1528706295000 } ], "dbOrphans": [ { "issueId": 10306, "lastUpdated": 1529308219425 } ], "outdatedIssueData": [ { "issueId": 10102, "dbLastUpdated": 1528706225000, "indexLastUpdated": 1528706405655 } ], "okCount": 72, "outdatedCount": 1, "indexOrphansCount": 1, "dbOrphansCount": 1, "lastAnalyzeTimestamp": 1529308274757, "indexHealth": 97.297295 }

Cause

There could be multiple causes for such issues, like:

  • Replication problems (most likely);

  • Transaction rollback issues in post-functions;

  • Direct DB manipulation

Solution

Call a POST request to the endpoint /rest/indexanalyzer/1/heal

The maxResults input defaults to 100, and allows a maximum of 1000 issues to be fixed.

Here's an output example in which 20 issues shouldn't be in the index:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 { "analyzeBeforeResult": { "indexOrphans": [ { "issueId": 10001, "lastUpdated": 1710515196000 }, { "issueId": 10003, "lastUpdated": 1710515195000 }, { "issueId": 10004, "lastUpdated": 1710515198000 }, { "issueId": 10005, "lastUpdated": 1710515195000 }, { "issueId": 10006, "lastUpdated": 1705434794000 }, { "issueId": 10007, "lastUpdated": 1710515196000 }, { "issueId": 10200, "lastUpdated": 1710515196000 }, { "issueId": 10201, "lastUpdated": 1710515194000 }, { "issueId": 10009, "lastUpdated": 1710515195000 }, { "issueId": 10010, "lastUpdated": 1705099512000 }, { "issueId": 10202, "lastUpdated": 1710515196000 }, { "issueId": 10011, "lastUpdated": 1705176612000 }, { "issueId": 10203, "lastUpdated": 1710515198000 }, { "issueId": 10204, "lastUpdated": 1710528950000 }, { "issueId": 10015, "lastUpdated": 1710515194000 }, { "issueId": 10016, "lastUpdated": 1710515198000 }, { "issueId": 10400, "lastUpdated": 1710515057000 }, { "issueId": 10023, "lastUpdated": 1705437162000 }, { "issueId": 10100, "lastUpdated": 1705951944000 }, { "issueId": 10101, "lastUpdated": 1710515198000 } ], "dbOrphans": [], "outdatedIssueData": [], "okCount": 12, "outdatedCount": 0, "indexOrphansCount": 20, "dbOrphansCount": 0, "lastAnalyzeTimestamp": 1710788040307, "indexHealth": 100.0 }, "analyzeBeforeTimeMillis": 13, "healerResult": { "reindexedDbOrphansSuccessful": { "count": 0, "ids": [] }, "reindexedDbOrphansFailed": { "count": 0, "ids": [] }, "reindexedOutdatedIssuesSuccessful": { "count": 0, "ids": [] }, "reindexedOutdatedIssuesFailed": { "count": 0, "ids": [] }, "deindexedIndexOrphansSuccessful": { "count": 20, "ids": [ 10001, 10003, 10004, 10005, 10006, 10007, 10200, 10201, 10009, 10010, 10202, 10011, 10203, 10204, 10015, 10016, 10400, 10023, 10100, 10101 ] }, "deindexedIndexOrphansFailed": { "count": 0, "ids": [] } }, "healTimeMillis": 53, "analyzeAfterResult": { "indexOrphans": [], "dbOrphans": [], "outdatedIssueData": [], "okCount": 12, "outdatedCount": 0, "indexOrphansCount": 0, "dbOrphansCount": 0, "lastAnalyzeTimestamp": 1710788040387, "indexHealth": 100.0 }, "analyzeAfterTimeMillis": 25 }

Here's the atlassian-jira.log file output in the node:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2024-03-18 15:54:00,308-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Reindexing 0 of 0 issues missing from the index 2024-03-18 15:54:00,310-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Done reindexing issues missing from the index 2024-03-18 15:54:00,310-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Reindexing 0 of 0 issues outdated in the index 2024-03-18 15:54:00,310-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Done reindexing issues outdated in the index 2024-03-18 15:54:00,310-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing 20 of 20 issues absent from the database 2024-03-18 15:54:00,310-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10001 2024-03-18 15:54:00,346-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10003 2024-03-18 15:54:00,348-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10004 2024-03-18 15:54:00,349-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10005 2024-03-18 15:54:00,349-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10006 2024-03-18 15:54:00,349-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10007 2024-03-18 15:54:00,350-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10200 2024-03-18 15:54:00,351-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10201 2024-03-18 15:54:00,352-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10009 2024-03-18 15:54:00,352-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10010 2024-03-18 15:54:00,352-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10202 2024-03-18 15:54:00,354-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10011 2024-03-18 15:54:00,354-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10203 2024-03-18 15:54:00,355-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10204 2024-03-18 15:54:00,356-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10015 2024-03-18 15:54:00,356-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10016 2024-03-18 15:54:00,356-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10400 2024-03-18 15:54:00,356-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10023 2024-03-18 15:54:00,357-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10100 2024-03-18 15:54:00,358-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Deindexing issue, issueId=10101 2024-03-18 15:54:00,360-0300 http-nio-49122-exec-15 url: /j9122/rest/indexanalyzer/1/heal; user: agandelman INFO agandelman 954x207x1 3vi0d2 0:0:0:0:0:0:0:1 /rest/indexanalyzer/1/heal [c.a.j.p.indexanalyzer.impl.DefaultIndexHealer] Done deindexing issues absent from the database
Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.