Reindexing
Starting SonarQube Server after an upgrade or after a restore from a backup triggers a rebuild of the Elasticsearch indexes.
Project, application, and portfolio availability
Most features are available during reindexing (for example, you can already analyze your projects), but some only become available when the process is complete:
- Project issues and security hotspots: Available, but some filters and the ability to add tags become available only when reindexing is complete.
- Security reports: Available when reindexing is complete.
- Applications and portfolios: Issues, security hotspots, and security reports become available once all their associated projects are reindexed.
- The global Issues page is unavailable until all projects are reindexed.
SonarQube Server uses analysis dates to determine which projects to prioritize during reindexing. Your projects with the most recent analysis dates are the first to become fully available in the UI.
Administrators can track the full reindexing progress:
- Within the banner displayed in SonarQube Server.
- In the background tasks.
If a project fails to reindex, see Reindexing a single project below.
Running analyses during reindexing
Reindexing starts once SonarQube Server is up and running. You can run analyses on your projects on the CI side while indexes are being rebuilt. The processing of analysis results takes priority over reindexing tasks, so your SonarQube Server instance is effectively operational.
Administrators can check the progress of these analyses in Administration > Projects > Background tasks.
Quality gate timeout
When calculating the quality gate of a project that is actively being indexed, SonarQube Server will finish indexing to allow computation to complete before returning quality gate status. If the indexing does not finish by the Quality Gate timeout setting, then the Quality Gate will time out.
Forcing an Elasticsearch redindex
You can trigger a full Elasticsearch reindex. During the reindex, SonarQube Server will detect out-of-sync indices and correct them.
Full Elasticsearch reindex can be quite lengthy depending on the size of your instance.
In SonarQube Server (Developer Edition, Enterprise Edition)
- Stop the server.
- Remove the contents of the <sonarqubeHome>/data/es8 directory where <sonarqubeHome>:
- For a ZIP installation: is the location where the SonarQube distribution has been unzipped.
- For a Docker installation: is the installation directory of SonarQube within your container. This path is stored in the SONARQUBE_HOME environment variable.
- Start the server.
In SonarQube Server Data Center Edition
- Stop the cluster as follows: stop first the application nodes and then the search nodes.
- On each search node, remove the contents of the <sonarqubeHome>/data/es8 directory where <sonarqubeHome>:
- For a ZIP installation: is the location where the SonarQube distribution has been unzipped.
- For a Docker installation: is the installation directory of SonarQube within your container. This path is stored in the SONARQUBE_HOME environment variable.
- Start your cluster as follows: start first the search nodes and then the application nodes.
Reindexing a single project
You may have to reindex a project if it shows inconsistent data or fails to reindex after an instance version upgrade or during a forced ElasticSearch reindex. To perform this procedure, you need the Administer System permission.
To reindex a single project:
- Use the SonarQube Server Web API api/issues/reindex.
Was this page helpful?