younifyd
Menu

Reindex documents

Reindex documents

POST/_reindex

Use it in a workflow

  1. Add a step and choose the Elasticsearch connector.
  2. Pick the Reindex documents action (under document).
  3. Fill in the fields below, then reference the result from later steps as {{reindexDocuments.response.data}}.

Request

Query parameters

refreshboolean

If `true`, the request refreshes affected shards to make this operation visible to search.

requests_per_secondnumber

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.

scrolloneOf

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.

slicesoneOf

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.

max_docsnumber

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. If `slices` is set, the `max_docs` limit is split evenly across the slices. If the number of documents in the source is equal to or slightly more than `max_docs`, this could result in slightly fewer than `max_docs` documents being reindexed, due to skew in the slicing.

timeoutoneOf

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.

wait_for_active_shardsoneOf

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.

wait_for_completionboolean

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.

require_aliasboolean

If `true`, the destination must be an index alias.

Request body

Enter the body as JSON in the step's Body field.

conflictsany

Indicates whether to continue reindexing even when there are conflicts.

Default "abort"

destanyrequired

The destination you are copying to.

max_docsnumber

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.

scriptany

The script to run to update the document source or metadata when reindexing.

sourceanyrequired

The source you are copying from.

json
{
  "dest": null,
  "source": null,
  "conflicts": "abort",
  "max_docs": 0,
  "script": null
}

Response

Returns 200 with an object. Read it in later steps with {{reindexDocuments.response.data.<field>}}.

batchesnumber

The number of scroll responses that were pulled back by the reindex.

creatednumber

The number of documents that were successfully created.

deletednumber

The number of documents that were successfully deleted.

failuresarray<object>

If there were any unrecoverable errors during the process, it is an array of those failures. If this array is not empty, the request ended because of those failures. Reindex is implemented using batches and any failure causes the entire process to end but all failures in the current batch are collected into the array. You can use the `conflicts` option to prevent the reindex from ending on version conflicts.

causeanyrequired
idanyrequired
indexanyrequired
statusnumberrequired
noopsnumber

The number of documents that were ignored because the script used for the reindex returned a `noop` value for `ctx.op`.

retriesany

The number of retries attempted by reindex.

requests_per_secondnumber

The number of requests per second effectively run during the reindex.

slice_idnumber
slicesarray<object>

Status of each slice if the reindex was sliced

slice_idnumber

The slice ID

batchesnumberrequired

The number of scroll responses pulled back by the reindex.

creatednumber

The number of documents that were successfully created.

deletednumberrequired

The number of documents that were successfully deleted.

noopsnumberrequired

The number of documents that were ignored because the script used for the reindex returned a `noop` value for `ctx.op`.

requests_per_secondnumberrequired

The number of requests per second effectively executed during the reindex.

retriesanyrequired

The number of retries attempted by reindex. `bulk` is the number of bulk actions retried and `search` is the number of search actions retried.

throttledany
throttled_millisanyrequired

Number of milliseconds the request slept to conform to `requests_per_second`.

throttled_untilany
throttled_until_millisanyrequired

This field should always be equal to zero in a `_reindex` response. It only has meaning when using the Task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be executed again in order to conform to `requests_per_second`.

totalnumberrequired

The number of documents that were successfully processed.

updatednumber

The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex updating it.

version_conflictsnumberrequired

The number of version conflicts that reindex hits.

cancelledstring

The reason for cancellation if the slice was canceled

taskany
throttled_millisany

The number of milliseconds the request slept to conform to `requests_per_second`.

throttled_until_millisany

This field should always be equal to zero in a reindex response. It has meaning only when using the task API, where it indicates the next time (in milliseconds since epoch) that a throttled request will be run again in order to conform to `requests_per_second`.

timed_outboolean

If any of the requests that ran during the reindex timed out, it is `true`.

tookany

The total milliseconds the entire operation took.

totalnumber

The number of documents that were successfully processed.

updatednumber

The number of documents that were successfully updated. That is to say, a document with the same ID already existed before the reindex updated it.

version_conflictsnumber

The number of version conflicts that occurred.

json
{
  "batches": 0,
  "created": 0,
  "deleted": 0,
  "failures": [
    {
      "cause": null,
      "id": null,
      "index": null,
      "status": 0
    }
  ],
  "noops": 0,
  "retries": null,
  "requests_per_second": 0,
  "slice_id": 0,
  "slices": [
    {
      "batches": 0,
      "deleted": 0,
      "noops": 0,
      "requests_per_second": 0,
      "retries": null,
      "throttled_millis": null,
      "throttled_until_millis": null,
      "total": 0,
      "version_conflicts": 0,
      "slice_id": 0,
      "created": 0,
      "throttled": null
    }
  ],
  "task": null,
  "throttled_millis": null,
  "throttled_until_millis": null
}

Need more? See the Elasticsearch guide for connection setup and behaviour shared by every action.