---
type: api
title: Stop data frame analytics jobs
description: A data frame analytics job can be started and stopped multiple times
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-ml-stop-data-frame-analytics
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-ml-stop-data-frame-analytics
products:
  - Elasticsearch
---

# Stop data frame analytics jobs

Availability: Generally available since 7.3

## Paths

- `POST` `/_ml/data_frame/analytics/{id}/_stop`

#### Path parameters

- `id` (string) — required
  Identifier for the data frame analytics job. This identifier can contain
lowercase alphanumeric characters (a-z and 0-9), hyphens, and
underscores. It must start and end with alphanumeric characters.

## Description

A data frame analytics job can be started and stopped multiple times
throughout its lifecycle.

## Required authorization

- Cluster privileges: `manage_ml`

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

- `allow_no_match` (boolean · default: true) — optional
  Specifies what to do when the request:

1. Contains wildcard expressions and there are no data frame analytics
jobs that match.
2. Contains the _all string or no identifiers and there are no matches.
3. Contains wildcard expressions and there are only partial matches.

The default value is true, which returns an empty data_frame_analytics
array when there are no matches and the subset of results when there are
partial matches. If this parameter is false, the request returns a 404
status code when there are no matches or only partial matches.
- `force` (boolean · default: false) — optional
  If true, the data frame analytics job is stopped forcefully.
- `timeout` (string · default: 20s) — optional
  Controls the amount of time to wait until the data frame analytics job
stops. Defaults to 20 seconds.

## Request body

`application/json`

- `id` (string) — optional
  If provided, must be the same identifier as in the path.
- `allow_no_match` (boolean · default: true) — optional
  Specifies what to do when the request:

1. Contains wildcard expressions and there are no data frame analytics
jobs that match.
2. Contains the _all string or no identifiers and there are no matches.
3. Contains wildcard expressions and there are only partial matches.

The default value is true, which returns an empty data_frame_analytics
array when there are no matches and the subset of results when there are
partial matches. If this parameter is false, the request returns a 404
status code when there are no matches or only partial matches.
- `force` (boolean · default: false) — optional
  If true, the data frame analytics job is stopped forcefully.
- `timeout` (string · default: 20s) — optional
  Controls the amount of time to wait until the data frame analytics job
stops. Defaults to 20 seconds.

## Response

`application/json`

- `stopped` (boolean)
## Code examples

#### Console

```console
POST _ml/data_frame/analytics/loganalytics/_stop
```

#### JavaScript

```javascript
const response = await client.ml.stopDataFrameAnalytics({
  id: "loganalytics",
});
```

#### Python

```python
resp = client.ml.stop_data_frame_analytics(
    id="loganalytics",
)
```

#### curl

```curl
curl -X POST "$ELASTICSEARCH_URL/_ml/data_frame/analytics/loganalytics/_stop" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.ml().stopDataFrameAnalytics(s -> s
    .id("loganalytics")
);
```

#### C#

```c#
var response = await client.MachineLearning.StopDataFrameAnalyticsAsync(id: "loganalytics");
```

#### PHP

```php
$resp = $client->ml()->stopDataFrameAnalytics([
    "id" => "loganalytics",
]);
```

#### Ruby

```ruby
response = client.ml.stop_data_frame_analytics(
  id: "loganalytics"
)
```

