Reindex API

edit

This API is experimental and may be changed or removed completely in a future release. The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are currently experimental.

When checking the upgrade status, some indices will have the reindex paramaeter set to true. You can use this Reindexing API to reindex these indices.

Start or resume a reindex

edit

Request

edit

To start a new reindex or resume a paused reindex, submit a POST request to the /api/upgrade_assistant/reindex/<indexName> endpoint:

Note: You cannot access this endpoint via the Console in Kibana.

POST /api/upgrade_assistant/reindex/myIndex

Response

edit

A successful call returns a response code of 200 and a response body containing a JSON structure similar to the following example:

{
  "indexName": ".ml-state",
  "newIndexName": ".reindexed-v7-ml-state",
  "status": 0,
  "lastCompletedStep": 0,
  "reindexTaskId": null,
  "reindexTaskPercComplete": null,
  "errorMessage": null
}

See the next section for an explanation of each field.

Check the status of a reindex

edit

Request

edit

Once a reindex is started, you can check the status of the reindex operation by submitting a GET request to the /api/upgrade_assistant/reindex/<indexName> endpoint:

Note: You cannot access this endpoint via the Console in Kibana.

GET /api/upgrade_assistant/reindex/myIndex

Response

edit

A successful call returns a response code of 200 and a response body containing a JSON structure similar to the following example:

{
  "reindexOp": {
    "indexName": ".ml-state",
    "newIndexName": ".reindexed-v7-ml-state", 
    "status": 0, 
    "lastCompletedStep": 40, 
    "reindexTaskId": "QprwvTMzRQ2MLWOW22oQ4Q:11819", 
    "reindexTaskPercComplete": 0.3, 
    "errorMessage": null 
  },
  "warnings": [], 
  "hasRequiredPrivileges": true 
}

Name of the new index that is being created.

Current status of the reindex. See the status code table for details.

Last successfully completed step of the reindex. See the step code table table for details.

Task ID of the reindex task in Elasticsearch. Only present if reindexing has started.

Percentage of how far the reindexing task in Elasticsearch has progressed, in decimal from from 0 to 1.

Error that caused the reindex to fail, if it failed.

An array of any warning codes explaining what changes are required for this reindex. See the warning code table for details.

Whether or not the current user has required privileges to reindex this index. Returns true if Security is not available or disabled.

Status code

edit

The status field corresponds to these statuses:

0

in progress

1

completed

2

failed

3

paused

4

cancelled

Step code

edit

The lastCompletedStep field corresponds to these steps:

0

The reindex operation has been created in Kibana.

10

Index group services stopped. Only applies to some system indices.

20

index set to readonly

30

The new destination index has been created.

40

The reindex task in Elasticsearch has started.

50

The reindex task in Elasticsearch has completed.

60

Aliases have been created to point to the new index, and the old index has been deleted.

70

Index group services have been resumed. Only applies to some system indices.

Warning code

edit

The warnings field corresponds to an array of integers for these warnings:

0

The _all meta field will be removed.

1

Any coerced boolean values will be converted in the source document (example: yes, 1, off).

2

Documents will be converted to support Elastic Common Schema. Only applies to APM indices created in 6.x.

Paused reindexes

edit

If the Kibana node that started the reindex is shutdown or restarted, the reindex will go into a paused state after some time. To resume the reindex, you must submit a new POST request to the /api/upgrade_assistant/reindex/<indexName> endpoint.

Cancel a reindex

edit

Request

edit

You can cancel reindexes that are waiting for the Elasticsearch reindex task to complete (lastCompletedStep set to 40). To cancel a reindex, submit a POST request to the /api/upgrade_assistant/reindex/<indexName>/cancel endpoint:

Note: You cannot access this endpoint via the Console in Kibana.

POST /api/upgrade_assistant/reindex/myIndex/cancel

Response

edit

A successful call returns a response code of 200 and a response body containing a JSON structure similar to the following example:

{
  "acknowledged": true
}