[role="xpack"]
[[data-stream-reindex-cancel-api]]
=== Reindex data stream cancel API
++++
<titleabbrev>Reindex data stream cancel</titleabbrev>
++++

.New API reference
[sidebar]
--
For the most up-to-date API details, refer to {api-es}/group/endpoint-migration[Migration APIs].
--

include::{es-ref-dir}/migration/apis/shared-migration-apis-tip.asciidoc[]

Cancels a running data stream reindex task which was started by the <<data-stream-reindex-api, data stream reindex API>>.
Any backing indices that have already been reindexed and swapped into the data stream will remain in the data stream.
Only backing indices which are currently being reindexed, or pending backing indices which are still waiting to be reindexed, will be cancelled.
Once a data stream reindex task is cancelled it will no longer be accessible through the
<<data-stream-reindex-status-api,status API>>. If a reindex task is not currently running
this API will return `resource_not_found_exception`.


///////////////////////////////////////////////////////////
[source,console]
------------------------------------------------------
POST _migration/reindex
{
    "source": {
        "index": "my-data-stream"
    },
    "mode": "upgrade"
}
------------------------------------------------------
// TESTSETUP
// TEST[setup:my_data_stream]
///////////////////////////////////////////////////////////


[source,console]
----
POST _migration/reindex/my-data-stream/_cancel
----
// TEST[teardown:data_stream_cleanup]

[[data-stream-reindex-cancel-request]]
==== {api-request-title}

`GET /_migration/reindex/<data-stream>/_cancel`


[[data-stream-reindex-cancel-prereqs]]
==== {api-prereq-title}

* If the {es} {security-features} are enabled, you must have the `manage`
<<privileges-list-indices,index privilege>> for the data stream.

[[data-stream-reindex-cancel-path-params]]
==== {api-path-parms-title}

`<data-stream>`::
(Required, string)
Name of data stream to cancel reindexing.

