---
type: api
title: Start a data frame analytics job
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/v9/operation/operation-ml-start-data-frame-analytics
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-ml-start-data-frame-analytics
products:
  - Elasticsearch
---

# Start a data frame analytics job

Availability: Generally available since 7.3

## Paths

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

#### 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.
If the destination index does not exist, it is created automatically the
first time you start the data frame analytics job. The
`index.number_of_shards` and `index.number_of_replicas` settings for the
destination index are copied from the source index. If there are multiple
source indices, the destination index copies the highest setting values. The
mappings for the destination index are also copied from the source indices.
If there are any mapping conflicts, the job fails to start.
If the destination index exists, it is used as is. You can therefore set up
the destination index in advance with custom settings and mappings.

## Required authorization

- Index privileges: `create_index`, `index`, `manage`, `read`, `view_index_metadata`
- 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/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Query string parameters

- `timeout` (string · default: 20s) — optional
  Controls the amount of time to wait until the data frame analytics job
starts.

## Request body

`application/json`

- `id` (string) — optional
  If provided, must be the same identifier as in the path.
- `timeout` (string · default: 20s) — optional
  Controls the amount of time to wait until the data frame analytics job
starts.

## Response

`application/json`

- `acknowledged` (boolean)
- `node` (string)
  The ID of the node that the job was started on. If the job is allowed to open lazily and has not yet been assigned to a node, this value is an empty string.
The node ID of the node the job has been assigned to, or
an empty string if it hasn't been assigned to a node. In
serverless if the job has been assigned to run then the
node ID will be "serverless".
## Code examples

#### Console

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

#### JavaScript

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

#### Python

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

#### curl

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

#### Java

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

#### C#

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

#### PHP

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

#### Ruby

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

