---
type: api
title: Stop rollup jobs
description: If you try to stop a job that does not exist, an exception occurs.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-rollup-stop-job
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-rollup-stop-job
products:
  - Elasticsearch
---

# Stop rollup jobs

deprecated

Availability: Experimental since 6.3

## Paths

- `POST` `/_rollup/job/{id}/_stop`

#### Path parameters

- `id` (string) — required
  Identifier for the rollup job.

## Description

If you try to stop a job that does not exist, an exception occurs.
If you try to stop a job that is already stopped, nothing happens.

Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped.
This is accomplished with the `wait_for_completion` query parameter, and optionally a timeout. For example:

```
POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s
```
The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed.
If the specified time elapses without the job moving to STOPPED, a timeout exception occurs.

## Required authorization

- Cluster privileges: `manage_rollup`

## 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

- `timeout` (string · default: 30s) — optional
  If `wait_for_completion` is `true`, the API blocks for (at maximum) the specified duration while waiting for the job to stop.
If more than `timeout` time has passed, the API throws a timeout exception.
NOTE: Even if a timeout occurs, the stop request is still processing and eventually moves the job to STOPPED.
The timeout simply means the API call itself timed out while waiting for the status change.
- `wait_for_completion` (boolean · default: false) — optional
  If set to `true`, causes the API to block until the indexer state completely stops.
If set to `false`, the API returns immediately and the indexer is stopped asynchronously in the background.

## Response

`application/json`

- `stopped` (boolean)
## Code examples

#### Console

```console
POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s
```

#### JavaScript

```javascript
const response = await client.rollup.stopJob({
  id: "sensor",
  wait_for_completion: "true",
  timeout: "10s",
});
```

#### Python

```python
resp = client.rollup.stop_job(
    id="sensor",
    wait_for_completion=True,
    timeout="10s",
)
```

#### curl

```curl
curl -X POST "$ELASTICSEARCH_URL/_rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.rollup().stopJob(s -> s
    .id("sensor")
    .timeout(t -> t
        .time("10s")
    )
    .waitForCompletion(true)
);
```

#### C#

```c#
var response = await client.Rollup
    .StopJobAsync(id: "sensor", d1 => d1
        .Timeout("10s")
        .WaitForCompletion(true)
    );
```

#### PHP

```php
$resp = $client->rollup()->stopJob([
    "id" => "sensor",
    "wait_for_completion" => "true",
    "timeout" => "10s",
]);
```

#### Ruby

```ruby
response = client.perform_request(
  "POST",
  "/_rollup/job/sensor/_stop",
  {
    "wait_for_completion": "true",
    "timeout": "10s"
  },
)
```

