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

# Throttle a delete by query operation

Availability: Generally available since 6.5

## Paths

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

#### Path parameters

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

## Description

Change the number of requests per second for a particular delete 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.

## 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/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Query string parameters

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

- `node_failures` (object[])
  - `type` (string)
    The type of error
  - `reason` (union string) — nullable
    A human-readable explanation of the error, in English.
    One of: `string`
  - `stack_trace` (string)
    The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
  - `caused_by` (object) — recursive
    Same fields as `node_failures`
  - `root_cause` (object[]) — recursive
    Same fields as `node_failures`
  - `suppressed` (object[]) — recursive
    Same fields as `node_failures`
- `task_failures` (object[])
  - `task_id` (number)
  - `node_id` (string)
  - `status` (string)
  - `reason` (object)
    - `type` (string)
      The type of error
    - `reason` (union string) — nullable
      A human-readable explanation of the error, in English.
      One of: `string`
    - `stack_trace` (string)
      The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
    - `caused_by` (object) — recursive
      Same fields as `reason` in `task_failures`
    - `root_cause` (object[]) — recursive
      Same fields as `reason` in `task_failures`
    - `suppressed` (object[]) — recursive
      Same fields as `reason` in `task_failures`
- `nodes` (map string to object)
  Task information grouped by node, if `group_by` was set to `node` (the default).
  Map values (object)
  - `name` (string)
  - `transport_address` (string)
  - `host` (string)
  - `ip` (string)
  - `roles` (string[])
  - `attributes` (map string to string)
  - `tasks` (map string to object)
    Map values (object)
    - `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)
    - `running_time_in_nanos` (number)
    - `start_time_in_millis` (number)
    - `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)
    - `original_task_id` (string)
      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` (number)
      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.
- `tasks` (union)
  Either a flat list of tasks if `group_by` was set to `none`, or grouped by parents if
`group_by` was set to `parents`.
## Code examples

#### Console

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

#### JavaScript

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

#### Python

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

#### curl

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

#### Java

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

#### C#

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

#### PHP

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

#### Ruby

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

