Reindex documents Added in 2.3.0
Copies documents from a source to a destination. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself.
Query parameters
-
refresh boolean
If
true
, the request refreshes affected shards to make this operation visible to search. -
requests_per_second number
The throttle for this request in sub-requests per second. Defaults to no throttle.
-
scroll string
Specifies how long a consistent view of the index should be maintained for scrolled search.
-
slices number | string
The number of slices this task should be divided into. Defaults to 1 slice, meaning the task isn’t sliced into subtasks.
-
timeout string
Period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards.
-
wait_for_active_shards number | string
The number of shard copies that must be active before proceeding with the operation. Set to
all
or any positive integer up to the total number of shards in the index (number_of_replicas+1
). -
wait_for_completion boolean
If
true
, the request blocks until the operation is complete. -
require_alias boolean
If
true
, the destination must be an index alias.
curl \
-X POST http://api.example.com/_reindex \
-H "Content-Type: application/json" \
-d '{"conflicts":"abort","dest":{"index":"string","op_type":"index","pipeline":"string","routing":"string","version_type":"internal"},"max_docs":42.0,"script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"size":42.0,"source":{"index":"string","query":{},"remote":{"connect_timeout":"string","headers":{"additionalProperty1":"string","additionalProperty2":"string"},"host":"string","username":"string","password":"string","socket_timeout":"string"},"size":42.0,"slice":{"field":"string","id":"string","max":42.0},"":"string","_source":"string","runtime_mappings":{"additionalProperty1":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"},"additionalProperty2":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"}}}}'