﻿---
title: stack es ml put-datafeed cli command
description: Create a datafeed. Behaviour flags: --dry-run — validate all inputs and exit without performing any action 
url: https://www.elastic.co/elastic/docs-builder/docs/4097/reference/elastic-cli/cli/stack/es/ml/put-datafeed
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# stack es ml put-datafeed cli command
<cli-modifiers>
</cli-modifiers>

```bash
elastic stack es ml put-datafeed --datafeed-id <datafeed-id> [options]
```

Create a datafeed.
**Behaviour flags:**
`--dry-run` — validate all inputs and exit without performing any action

## Options

<definitions>
  <definition term="--datafeed-id string required">
    A numerical character string that uniquely identifies the datafeed.
    This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
    It must start and end with alphanumeric characters.
  </definition>
  <definition term="--allow-no-indices">
    A setting that does two separate checks on the index expression.
    If `false`, the request returns an error (1) if any wildcard expression
    (including `_all` and `*`) resolves to zero matching indices or (2) if the
    complete set of resolved indices, aliases or data streams is empty after all
    expressions are evaluated. If `true`, index expressions that resolve to no
    indices are allowed and the request returns an empty result.
  </definition>
  <definition term="--expand-wildcards enum">
    Type of index that wildcard patterns can match. If the request can target data streams, this argument determines
    whether wildcard expressions match hidden data streams. Supports comma-separated values.
    **Values:** all, open, closed, hidden, none
    **Repeatable:** pass `--expand-wildcards` multiple times to supply more than one value
  </definition>
  <definition term="--ignore-throttled">
    If true, concrete, expanded, or aliased indices are ignored when frozen.
  </definition>
  <definition term="--ignore-unavailable">
    If `false`, the request returns an error if it targets a concrete (non-wildcarded)
    index, alias, or data stream that is missing, closed, or otherwise unavailable.
    If `true`, unavailable concrete targets are silently ignored.
  </definition>
  <definition term="--aggregations string">
    If set, the datafeed performs aggregation searches.
    Support for aggregations is limited and should be used only with low cardinality data.
  </definition>
  <definition term="--chunking-config string">
    Datafeeds might be required to search over long time periods, for several months or years.
    This search is split into time chunks in order to ensure the load on Elasticsearch is managed.
    Chunking configuration controls how the size of these time chunks are calculated;
    it is an advanced configuration option.
  </definition>
  <definition term="--delayed-data-check-config string">
    Specifies whether the datafeed checks for missing data and the size of the window.
    The datafeed can optionally search over indices that have already been read in an effort to determine whether
    any data has subsequently been added to the index. If missing data is found, it is a good indication that the
    `query_delay` is set too low and the data is being indexed after the datafeed has passed that moment in time.
    This check runs only on real-time datafeeds.
  </definition>
  <definition term="--frequency string">
    The interval at which scheduled queries are made while the datafeed runs in real time.
    The default value is either the bucket span for short bucket spans, or, for longer bucket spans, a sensible
    fraction of the bucket span. When `frequency` is shorter than the bucket span, interim results for the last
    (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses
    aggregations, this value must be divisible by the interval of the date histogram aggregation.
  </definition>
  <definition term="--indices string">
    An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the master
    nodes and the machine learning nodes must have the `remote_cluster_client` role.
    **Repeatable:** pass `--indices` multiple times to supply more than one value
  </definition>
  <definition term="--indices-options string">
    Specifies index expansion options that are used during search
  </definition>
  <definition term="--job-id string">
    Identifier for the anomaly detection job.
  </definition>
  <definition term="--max-empty-searches number">
    If a real-time datafeed has never seen any data (including during any initial training period), it automatically
    stops and closes the associated job after this many real-time searches return no documents. In other words,
    it stops after `frequency` times `max_empty_searches` of real-time operation. If not set, a datafeed with no
    end time that sees no data remains started until it is explicitly stopped. By default, it is not set.
  </definition>
  <definition term="--query string">
    The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an
    Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this
    object is passed verbatim to Elasticsearch.
  </definition>
  <definition term="--query-delay string">
    The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might
    not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default
    value is randomly selected between `60s` and `120s`. This randomness improves the query performance
    when there are multiple jobs running on the same node.
  </definition>
  <definition term="--runtime-mappings string">
    Specifies runtime fields for the datafeed search.
  </definition>
  <definition term="--script-fields string">
    Specifies scripts that evaluate custom expressions and returns script fields to the datafeed.
    The detector configuration objects in a job can contain functions that use these script fields.
  </definition>
  <definition term="--scroll-size number">
    The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations.
    The maximum value is the value of `index.max_result_window`, which is 10,000 by default.
  </definition>
  <definition term="--headers string">
  </definition>
  <definition term="--error-trace">
    When set to `true` Elasticsearch will include the full stack trace of errors
    when they occur.
  </definition>
  <definition term="--filter-path string">
    Comma-separated list of filters in dot notation which reduce the response
    returned by Elasticsearch.
    **Repeatable:** pass `--filter-path` multiple times to supply more than one value
  </definition>
  <definition term="--human">
    When set to `true` will return statistics in a format suitable for humans.
    For example `"exists_time": "1h"` for humans and
    `"exists_time_in_millis": 3600000` for computers. When disabled the human
    readable values will be omitted. This makes sense for responses being consumed
    only by machines.
  </definition>
  <definition term="--pretty">
    If set to `true` the returned JSON will be "pretty-formatted". Only use
    this option for debugging only.
  </definition>
  <definition term="--input-file string">
    path to a JSON file to use as command input
  </definition>
  <definition term="--dry-run">
    validate all inputs and exit without performing any action (preview changes without applying them)
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="--json">
    output as JSON
  </definition>
</definitions>