﻿---
title: stack es reindex cli command
description: Reindex documents. Behaviour flags: --dry-run — validate all inputs and exit without performing any action 
url: https://www.elastic.co/elastic/docs-builder/docs/4118/reference/elastic-cli/cli/stack/es/reindex
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# stack es reindex cli command
<cli-modifiers>
</cli-modifiers>

```bash
elastic stack es reindex --dest <dest> --source <source> [options]
```

Reindex documents.
**Behaviour flags:**
`--dry-run` — validate all inputs and exit without performing any action

## Options

<definitions>
  <definition term="--dest string required">
    The destination you are copying to.
  </definition>
  <definition term="--source string required">
    The source you are copying from.
  </definition>
  <definition term="--refresh">
    If `true`, the request refreshes affected shards to make this operation visible to search.
  </definition>
  <definition term="--requests-per-second number">
    The maximum number of documents to index per second, across the entire reindex operation (including slices).
    It can be either `-1` to turn off throttling or any decimal number like `1.7` or `12` to throttle to that level.
  </definition>
  <definition term="--scroll string">
    The period of time that a consistent view of the index should be maintained for scrolled search.
    In serverless, and stack versions >= v9.5.0, we use PIT rather than scroll for pagination.
    We only use scroll for reindexing from remote clusters that are older than v7.10.0.
    Therefore, this parameter is ignored unless you are reindexing from a remote cluster that is older than v7.10.0.
  </definition>
  <definition term="--slices string">
    The number of slices this task should be divided into.
    It defaults to one slice, which means the task isn't sliced into subtasks. Reindex supports sliced scroll to parallelize the reindexing process.
    This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts. NOTE: Reindexing from remote clusters does not support manual or automatic slicing. If set to `auto`, Elasticsearch chooses the number of slices to use.
    This setting will use one slice per shard, up to a certain limit.
    If there are multiple sources, it will choose the number of slices based on the index or backing index with the smallest number of shards.
  </definition>
  <definition term="--max-docs number">
    The maximum number of documents to reindex.
    By default, all documents are reindexed.
    If it is a value less then or equal to `scroll_size`, a scroll will not be used to retrieve the results for the operation. If `conflicts` is set to `proceed`, the reindex operation could attempt to reindex more documents from the source than `max_docs` until it has successfully indexed `max_docs` documents into the target or it has gone through every document in the source query.
  </definition>
  <definition term="--timeout string">
    The period each indexing waits for automatic index creation, dynamic mapping updates, and waiting for active shards.
    By default, Elasticsearch waits for at least one minute before failing.
    The actual wait time could be longer, particularly when multiple waits occur.
  </definition>
  <definition term="--wait-for-active-shards string">
    The number of shard copies that must be active before proceeding with the operation.
    Set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).
    The default value is one, which means it waits for each primary shard to be active.
  </definition>
  <definition term="--wait-for-completion">
    If `true`, the request blocks until the operation is complete. If your requested reindex operation is complex or time-consuming,
    it might timeout due to transport-layer limitations. While the reindex will continue to be processed by the cluster, your
    client will not receive updates on status automatically after timeout. Set this option `true` if you anticipate a long-running reindex.
  </definition>
  <definition term="--require-alias">
    If `true`, the destination must be an index alias.
  </definition>
  <definition term="--conflicts enum">
    Indicates whether to continue reindexing even when there are conflicts.
    **Values:** abort, proceed
  </definition>
  <definition term="--script string">
    The script to run to update the document source or metadata when reindexing.
  </definition>
  <definition term="--error-trace">
    When set to `true` Elasticsearch will include the full stack trace of errors
    when they occur.
  </definition>
  <definition term="--filter-path string">
    Comma-separated list of filters in dot notation which reduce the response
    returned by Elasticsearch.
    **Repeatable:** pass `--filter-path` multiple times to supply more than one value
  </definition>
  <definition term="--human">
    When set to `true` will return statistics in a format suitable for humans.
    For example `"exists_time": "1h"` for humans and
    `"exists_time_in_millis": 3600000` for computers. When disabled the human
    readable values will be omitted. This makes sense for responses being consumed
    only by machines.
  </definition>
  <definition term="--pretty">
    If set to `true` the returned JSON will be "pretty-formatted". Only use
    this option for debugging only.
  </definition>
  <definition term="--input-file string">
    path to a JSON file to use as command input
  </definition>
  <definition term="--dry-run">
    validate all inputs and exit without performing any action (preview changes without applying them)
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="--json">
    output as JSON
  </definition>
</definitions>