Rebuild the Elasticsearch Index API
On this page
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#
Start a rebuild of the Elasticsearch index from the data currently in the database.
OpenAPI Spec
Request Body#
indexThe name of the index to rebuild. The possible values are:
fusionauth_entityThe entity search indexfusionauth_userThe 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.
{
"index": "fusionauth_user"
}Response#
| 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 or malformed. The response contains an Errors JSON object with the specific errors. FusionAuth also returns a 400 when the request needs a paid FusionAuth license and no license is present. |
| 401 | FusionAuth didn't authorize the request. The Authorization header is missing, the API key isn't valid, or the API key doesn't have permission for this endpoint and method. The response is empty. For more information, see Unauthorized Responses. |
| 500 | FusionAuth had an internal error and logged a stack trace in the FusionAuth log files. The response usually contains an Errors JSON object with the [Exception] general error code. On MySQL, a data field larger than the database column also returns 500. For more information, see Data Field Sizes. |
| 503 | The search index is unavailable or returned an error, so FusionAuth can't complete the request. The response contains a JSON body. |
Related
API documentation for the Retrieve the Status of an Index Rebuild API.
Learn about the APIs for retrieving and updating integrations.
API documentation for the FusionAuth Export System Logs API.
Learn about the APIs for retrieving and updating the system configuration.