Overview
The Maintenance API runs the operations of the Maintenance screen with an access token. It starts a reindex, reloads the document index, deletes the crawler indices, rebuilds the configuration indices, downloads diagnostic information, and returns the running state of these operations.
Authentication
Access to this API requires authentication using an access token. Specify the access token in the request header.
The access token must be granted the Admin API permission (Radmin-api by default). For details on how to obtain an access token and about permissions, see Admin API Overview.
Base URL
Endpoint List
| Method | Path | Description |
|---|---|---|
| GET | / | Get Operation Status |
| PUT | /reindex | Start Reindexing |
| PUT | /reload | Reload the Document Index |
| DELETE | /crawler | Delete the Crawler Indices |
| PUT | /rebuild | Rebuild Configuration Indices |
| GET | /diagnostic | Download Diagnostic Information |
Reindexing, reloading, deleting and rebuilding run asynchronously. A response with status 0 means that the operation was accepted, not that it has finished or succeeded. A request is rejected while the same operation is running.
Get Operation Status
Request
Response
| Field | Description |
|---|---|
operations[].name | Operation name: reindex (/reindex), reload_doc_index (/reload), clear_crawler_index (/crawler) or reindex_config (/rebuild) |
operations[].running | true while the operation is running |
operations[].hostname | Host name running the operation (only while running) |
operations[].created_time | Time the operation started, in epoch milliseconds (only while running) |
Note
Note the following when you read running.
falsedoes not mean success. It is alsofalseafter a failed operation. Failures are written to the server log.A reindex with
replace_aliasesset tofalseclears the running state as soon as the copy has been submitted to the search engine, so it showsfalsewhile documents are still being copied.The running state expires after
coordinator.operation.ttl(7200000 milliseconds, or 2 hours, by default) and is not extended. An operation that takes longer showsfalsewhile still running, and the same operation is accepted again.It is also
falsewhen the state cannot be read from the search engine.
Start Reindexing
Copies the documents of the current document index into a new index. All properties are optional, and the request can be sent without a body.
Request
| Field | Type | Default | Description |
|---|---|---|---|
replace_aliases | boolean | true | Move the fess.search and fess.update aliases to the new index after the copy has finished |
reset_dictionaries | boolean | false | Reset the dictionary settings. It has no effect with a search engine without the CodeLibs plugins |
number_of_shards_for_doc | string | Value of index.number_of_shards | Number of shards of the new index (up to 10 characters). The default is used if empty |
auto_expand_replicas_for_doc | string | Value of index.auto_expand_replicas | index.auto_expand_replicas of the new index (up to 10 characters). The default is used if empty |
HTTP status 400 is returned when the new index cannot be created, for example because the number of shards is invalid.
Response
Reload the Document Index
Writes the stored dictionaries to the files of the search engine, then closes and reopens the index that the fess.update alias points to. The index cannot be searched while it is closed. The request has no body.
Request
Note
This is not available with a search engine without the CodeLibs plugins (search_engine.type set to vanilla, aws or cloud); HTTP status 404 is returned.
Delete the Crawler Indices
Deletes the crawler indices (fess_crawler.queue, fess_crawler.data and fess_crawler.filter). The request has no body.
Request
Warning
Do not run this while a crawler is running.
Rebuild Configuration Indices
Recreates the configuration indices with the latest mappings. The stored data is carried over.
Request
| Field | Type | Default | Description |
|---|---|---|---|
rebuild_config_index | boolean | false | Rebuild the configuration indices (fess_config) |
rebuild_user_index | boolean | false | Rebuild the user indices (fess_user) |
rebuild_log_index | boolean | false | Rebuild the log indices (fess_log) |
load_bulk_data | boolean | false | Load the default data during the rebuild. Existing data is not overwritten |
Set at least one of rebuild_config_index, rebuild_user_index and rebuild_log_index to true. Unlike the administration screen, no target is selected by default.
Warning
Back up your configuration before you run this.
rebuild_config_index also deletes and recreates the indices that hold the access tokens and the running state (fess_config.access_token and fess_config.coordinator). While that happens, API authentication may fail and running may show false. In a test with little data, requests sent about once a second did not fail.
Download Diagnostic Information
Returns the same diagnostic zip file as the log download on the maintenance screen. For the files it contains, see Maintenance.
Request
Response
The response is an application/octet-stream file named log<yyyyMMddHHmm>.zip. It does not contain Admin API access tokens, and secret values in the configuration files are replaced with XXXXXXXX.
Warning
The log files and fess_basic_config.bulk are not masked. Check the contents before you send the zip file to others.
Error Responses
| HTTP status | status | Cause |
|---|---|---|
| 400 | 1 | The same operation is already running |
| 400 | 1 | The destination index of the reindex cannot be created |
| 400 | 1 | No rebuild target is specified |
| 400 | 1 | A property value is invalid, such as a string longer than 10 characters |
| 401 | 3 | The access token is missing or invalid, or lacks the permission |
| 404 | 9 | Reload with a search engine without the CodeLibs plugins |
A string other than true or false in a boolean property is not rejected; it is treated as false.
For details of the status values and HTTP status codes, see Admin API Overview.
Usage Examples
Get Operation Status
Start Reindexing
Reload the Document Index
Delete the Crawler Indices
Rebuild Configuration Indices
Download Diagnostic Information
References
Admin API Overview - Admin API overview
Backup API - Backup API
Maintenance - Maintenance administration guide