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

# Throttle an update by query operation

Availability: 6.5+

## Paths

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

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#bearerauth)

#### Path Parameters

- `task_id` (string Id)
  The ID for the task.

## Description

Change the number of requests per second for a particular update by query operation.
Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.

## Query String Parameters

- `requests_per_second` (number)
  The maximum number of documents to update per second, across the entire update_by_query 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.

## Response

`application/json`

- `nodes` (map string to UpdateByQueryRethrottleNode)
  Map values ({} UpdateByQueryRethrottleNode)
  - `attributes` (map string to string)
  - `host` (string)
  - `ip` (string)
  - `name` (string Name)
  - `roles` (NodeRoles)
    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 TaskInfo)
    Map values ({} TaskInfo)
    - `action` (string)
    - `cancelled` (boolean)
    - `cancellable` (boolean)
    - `description` (string)
      Human readable text that identifies the particular request that the task is performing.
For example, it might identify the search request being performed by a search task.
Other kinds of tasks have different descriptions, like `_reindex` which has the source and the destination, or `_bulk` which just has the number of requests and the destination indices.
Many requests will have only an empty description because more detailed information about the request is not easily available or particularly helpful in identifying the request.
    - `headers` (map string to string)
    - `id` (number)
    - `node` (string)
    - `running_time` (string Duration)
    - `running_time_in_nanos` (DurationValueUnitNanos)
    - `start_time_in_millis` (EpochTimeUnitMillis)
    - `status` (object)
      The internal status of the task, which varies from task to task.
The format also varies.
While the goal is to keep the status for a particular task consistent from version to version, this is not always possible because sometimes the implementation changes.
Fields might be removed from the status for a particular request so any parsing you do of the status might break in minor releases.
    - `type` (string)
    - `parent_task_id` (string TaskId)
    - `original_task_id` (string TaskId)
      The task ID of the original task. Only present when the task is continuing the work of an earlier task that was running on a node which has since shut down (i.e. a relocatable task).
For tasks that have not been relocated this is always equal to the task's own ID and is omitted from the response.
    - `original_start_time_in_millis` (EpochTimeUnitMillis)
      The time at which the original task started, in milliseconds since the Unix epoch. Only present together with `original_task_id`.
    - `original_start_time` (string)
      The time at which the original task started, as an ISO 8601 formatted string. Only present together with `original_task_id` and when the request includes the `?human=true` query parameter.
## Code Examples

#### Console

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

#### JavaScript

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

#### Python

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

#### curl

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

#### Java

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

#### C#

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

#### PHP

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

#### Ruby

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

