# Reindexing

Starting SonarQube [Upgrade guide](/sonarqube-server/10.1/setup-and-upgrade/upgrade-the-server/upgrade-guide.md) or after a [Backup and restore](/sonarqube-server/10.1/instance-administration/backup-and-restore.md) triggers a rebuild of the Elasticsearch indexes.

## Project, application, and portfolio availability <a href="#rebuild-of-elasticsearch-indexes" id="rebuild-of-elasticsearch-indexes"></a>

Projects and applications become available as they are reindexed. Before that, they are grayed out in the UI.

Portfolios become available once all projects are indexed.

SonarQube uses analysis dates to determine which projects to prioritize during reindexing. Your projects with the most recent analysis dates are the first to become available in the UI.

Administrators can track the full reindexing progress within the banner displayed in SonarQube.

## Running analyses during reindexing <a href="#running-analyses-during-reindexing" id="running-analyses-during-reindexing"></a>

Reindexing starts once SonarQube 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 instance is effectively operational.

Administrators can check the progress of these analyses in **Administration** > **Projects** > **Background tasks**.

## Quality gate timeout <a href="#quality-gate-timeout" id="quality-gate-timeout"></a>

When calculating the quality gate of a project that is actively being indexed, SonarQube 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 <a href="#forcing-es-reindex" id="forcing-es-reindex"></a>

You can trigger a full Elasticsearch reindex. During the reindex, SonarQube will detect out-of-sync indices and correct them.

{% hint style="warning" %}
Full Elasticsearch reindex can be quite lengthy depending on the size of your instance.
{% endhint %}

<details>

<summary>On the SonarQube server (Community Edition, Developer Edition, Enterprise Edition)</summary>

1. Stop the server.
2. 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.
3. Start the server.

</details>

<details>

<summary>On the SonarQube cluster (Data Center Edition)</summary>

1. Stop the cluster as follows: stop first the application nodes and then the search nodes.
2. 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.
3. Start your cluster as follows: start first the search nodes and then the application nodes.

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-server/10.1/instance-administration/reindexing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
