Reindex legacy backing indices Technical preview; Added in 8.18.0

POST /_migration/reindex

Reindex all legacy backing indices for a data stream. This operation occurs in a persistent task. The persistent task ID is returned immediately and the reindexing work is completed in that task.

application/json

Body Required

  • mode string Required

    Value is upgrade.

  • source object Required
    Hide source attribute Show source attribute object
    • index string Required

Responses

  • 200 application/json
    Hide response attribute Show response attribute object
    • acknowledged boolean Required

      For a successful response, this value is always true. On failure, an exception is returned instead.

POST _migration/reindex
{
    "source": {
        "index": "my-data-stream"
    },
    "mode": "upgrade"
}
resp = client.perform_request(
    "POST",
    "/_migration/reindex",
    headers={"Content-Type": "application/json"},
    body={
        "source": {
            "index": "my-data-stream"
        },
        "mode": "upgrade"
    },
)
const response = await client.transport.request({
  method: "POST",
  path: "/_migration/reindex",
  body: {
    source: {
      index: "my-data-stream",
    },
    mode: "upgrade",
  },
});
response = client.perform_request(
  "POST",
  "/_migration/reindex",
  {},
  {
    "source": {
      "index": "my-data-stream"
    },
    "mode": "upgrade"
  },
  { "Content-Type": "application/json" },
)
$requestFactory = Psr17FactoryDiscovery::findRequestFactory();
$streamFactory = Psr17FactoryDiscovery::findStreamFactory();
$request = $requestFactory->createRequest(
    "POST",
    "/_migration/reindex",
);
$request = $request->withHeader("Content-Type", "application/json");
$request = $request->withBody($streamFactory->createStream(
    json_encode([
        "source" => [
            "index" => "my-data-stream",
        ],
        "mode" => "upgrade",
    ]),
));
$resp = $client->sendRequest($request);
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"source":{"index":"my-data-stream"},"mode":"upgrade"}' "$ELASTICSEARCH_URL/_migration/reindex"
Request example
An example body for a `POST _migration/reindex` request.
{
    "source": {
        "index": "my-data-stream"
    },
    "mode": "upgrade"
}