---
type: api
title: Throttle a reindex operation
description: Change the number of requests per second for a particular reindex operation.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-reindex-rethrottle
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-reindex-rethrottle
products:
  - Elasticsearch
---

# Throttle a reindex operation

Availability: Generally available since 2.4

## Paths

- `POST` `/_reindex/{task_id}/_rethrottle`

#### Path parameters

- `task_id` (string) — required
  The task identifier, which can be found by using the tasks API.

## Description

Change the number of requests per second for a particular reindex operation.
For example:

```
POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
```

Rethrottling that speeds up the query takes effect immediately.
Rethrottling that slows down the query will take effect after completing the current batch.
This behavior prevents scroll timeouts.

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/guide/en/elasticsearch/reference/current/token-authentication-services.html)

## Query string parameters

- `requests_per_second` (number) — required
  The throttle for this request in sub-requests per second.
It can be either `-1` to turn off throttling or any decimal number like `1.7` or `12` to throttle to that level.

## Response

`application/json`

- `nodes` (map string to object)
  Map values (object)
  - `attributes` (map string to string)
  - `host` (string)
  - `ip` (string)
  - `name` (string)
  - `roles` (enum[])
    Values: `master`, `data`, `data_cold`, `data_content`, `data_frozen`, `data_hot`, `data_warm`, `client`, `ingest`, `ml`, `voting_only`, `transform`, `remote_cluster_client`, `coordinating_only`
  - `transport_address` (string)
  - `tasks` (map string to object)
    Map values (object)
    - `action` (string)
    - `cancellable` (boolean)
    - `description` (string)
    - `id` (number)
    - `node` (string)
    - `running_time_in_nanos` (number)
    - `start_time_in_millis` (number)
    - `status` (object)
      - `batches` (number)
        The number of scroll responses pulled back by the reindex.
      - `created` (number)
        The number of documents that were successfully created.
      - `deleted` (number)
        The number of documents that were successfully deleted.
      - `noops` (number)
        The number of documents that were ignored because the script used for the reindex returned a `noop` value for `ctx.op`.
      - `requests_per_second` (number)
        The number of requests per second effectively executed during the reindex.
      - `retries` (object)
        The number of retries attempted by reindex. `bulk` is the number of bulk actions retried and `search` is the number of search actions retried.
        - `bulk` (number)
          The number of bulk actions retried.
        - `search` (number)
          The number of search actions retried.
      - `throttled` (string)
      - `throttled_millis` (number)
        Number of milliseconds the request slept to conform to `requests_per_second`.
      - `throttled_until` (string)
      - `throttled_until_millis` (number)
        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`.
      - `total` (number)
        The number of documents that were successfully processed.
      - `updated` (number)
        The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex updating it.
      - `version_conflicts` (number)
        The number of version conflicts that reindex hits.
    - `type` (string)
    - `headers` (object)
## Code examples

#### Console

```console
POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
```

#### JavaScript

```javascript
const response = await client.reindexRethrottle({
  task_id: "r1A2WoRbTwKZ516z6NEs5A:36619",
  requests_per_second: "-1",
});
```

#### Python

```python
resp = client.reindex_rethrottle(
    task_id="r1A2WoRbTwKZ516z6NEs5A:36619",
    requests_per_second="-1",
)
```

#### curl

```curl
curl -X POST "$ELASTICSEARCH_URL/_reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.reindexRethrottle(r -> r
    .requestsPerSecond(-1.0F)
    .taskId("r1A2WoRbTwKZ516z6NEs5A:36619")
);
```

#### C#

```c#
var response = await client
    .ReindexRethrottleAsync(taskId: "r1A2WoRbTwKZ516z6NEs5A:36619", d1 => d1
        .RequestsPerSecond(-1f)
    );
```

#### PHP

```php
$resp = $client->reindexRethrottle([
    "task_id" => "r1A2WoRbTwKZ516z6NEs5A:36619",
    "requests_per_second" => "-1",
]);
```

#### Ruby

```ruby
response = client.reindex_rethrottle(
  task_id: "r1A2WoRbTwKZ516z6NEs5A:36619",
  requests_per_second: "-1"
)
```

