Update Datafeeds

The update datafeed API enables you to update certain properties of a datafeed.


POST _xpack/ml/datafeeds/<feed_id>/_update

Path Parameters

feed_id (required)
(string) Identifier for the datafeed

Request Body

The following properties can be updated after the datafeed is created:

(object) If set, the datafeed performs aggregation searches. For more information, see Datafeed Resources.
(object) Specifies how data searches are split into time chunks. See Chunking Configuration Objects.
(time units) 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. For example: 150s.
(array) An array of index names. Wildcards are supported. For example: ["it_ops_metrics", "server*"].
(string) A numerical character string that uniquely identifies the job.
(object) 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. By default, this property has the following value: {"match_all": {"boost": 1}}.
(time units) 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 60s.
(object) 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. For more information, see Script Fields.
(unsigned integer) The size parameter that is used in Elasticsearch searches. The default value is 1000.
(array) A list of types to search for within the specified indices. For example: ["network","sql","kpi"].

For more information about these properties, see Datafeed Resources.


You must have manage_ml, or manage cluster privileges to use this API. For more information, see Security Privileges.


The following example updates the query for the datafeed-it-ops-kpi datafeed so that only log entries of error level are analyzed:

POST _xpack/ml/datafeeds/datafeed-it-ops-kpi/_update
  "query": {
    "term": {
      "level": "error"

When the datafeed is updated, you receive the full datafeed configuration with with the updated values:

  "datafeed_id": "datafeed-it-ops-kpi",
  "job_id": "it-ops-kpi",
  "query_delay": "1m",
  "indices": ["it-ops"],
  "types": ["logs"],
  "query": {
    "term": {
      "level": {
        "value": "error",
        "boost": 1
  "scroll_size": 1000,
  "chunking_config": {
    "mode": "auto"