> For the complete documentation index, see [llms.txt](/docs/llms.txt)

# Rebuild the Elasticsearch index | FusionAuth Docs

API documentation for the FusionAuth Rebuild the Elasticsearch index API.

# Rebuild the Elasticsearch index

[Edit on GitHub](https://github.com/FusionAuth/fusionauth-site/blob/main/astro/src/content/docs/apis/system/rebuild-the-elasticsearch-index.mdx)

[View Markdown](/docs/apis/system/rebuild-the-elasticsearch-index.md)

This API is used to rebuild the Elasticsearch index. In general you do not need to rebuild the search index at runtime, and doing will cause additional CPU and I/O overhead to FusionAuth until the request has completed. Please be careful with this API.

This API may be useful if you are building a new FusionAuth environment from an existing database w/out moving over an existing search index. In this scenario you will need to rebuild the search index from the database in order see the Users show up in the UI or use any of the Search APIs.

Beginning in version `1.48.0`, index aliases are used to minimize any disruption to API requests utilizing the search index. In practice this should not affect you, but please be aware that FusionAuth will use the configured index name as an alias, and the actual index name will be suffixed with `_a` or `_b`.

For example, the default name for the user index is `fusionauth_user`. You can expect to see the actual index to be created as `fusionauth_user_a` with an alias added named `fusionauth_user`. Using this same example, when a reindex request is started, a new index named `fusionauth_user_b` will be created, and when the re-index operation is complete the alias `fusionauth_user` will be changed to point to `fusionauth_user_b` and the `fusionauth_user_a` will be deleted.

## Request[#](#request)

Rebuild the Elasticsearch index

POST/api/system/reindex

OpenAPI Spec

#### Request Body[#](#request-body)

`index`Stringrequired

The name of the index to rebuild. The possible values are:

*   `fusionauth_entity` The entity search index
*   `fusionauth_user` The user search index

Please note, that while the index names can be modified using the FusionAuth configuration, that does not change how you call this API. For example, even if you modify the configuration to name the user search index `fusionauth_user_dev`, you will still use `fusionauth_user` to indicate you wish to rebuild the user search index.

*Example Request JSON*

```json
{
  "index": "fusionauth_user"
}
```

## Response[#](#response)

*Response Codes*

| Code | Description |
| --- | --- |
| 202 | The request was successful. The re-index request has been started. No response body will be returned. |
| 400 | The request was invalid and/or malformed. The response will contain an [Errors](/docs/apis/errors) JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See [Authentication](/docs/apis/authentication). |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 503 | The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body. |