[[reference-ml-update_datafeed]]

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////

[discrete]
=== client.ml.updateDatafeed

Update a datafeed. You must stop and start the datafeed for the changes to be applied. When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at the time of the update and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead.

{ref}/ml-update-datafeed.html[{es} documentation]

[discrete]
==== Function signature

[source,ts]
----
(MlUpdateDatafeedRequest, options?): Promise<MlUpdateDatafeedResponse>
----

[discrete]
===== `MlUpdateDatafeedRequest`

[source,ts]
----
interface MlUpdateDatafeedRequest extends <<shared-type-request-base, RequestBase>> {
  datafeed_id: <<shared-type-id, Id>>
  allow_no_indices?: boolean
  expand_wildcards?: <<shared-type-expand-wildcards, ExpandWildcards>>
  ignore_throttled?: boolean
  ignore_unavailable?: boolean
  aggregations?: Record<string, AggregationsAggregationContainer>
  chunking_config?: MlChunkingConfig
  delayed_data_check_config?: MlDelayedDataCheckConfig
  frequency?: <<shared-type-duration, Duration>>
  indices?: string[]
  /** @alias indices */
  indexes?: string[]
  indices_options?: <<shared-type-indices-options, IndicesOptions>>
  job_id?: <<shared-type-id, Id>>
  max_empty_searches?: <<shared-type-integer, integer>>
  query?: QueryDslQueryContainer
  query_delay?: <<shared-type-duration, Duration>>
  runtime_mappings?: MappingRuntimeFields
  script_fields?: Record<string, <<shared-type-script-field, ScriptField>>>
  scroll_size?: <<shared-type-integer, integer>>
}
----

[discrete]
===== `MlUpdateDatafeedResponse`

[source,ts]
----
interface MlUpdateDatafeedResponse {
  authorization?: MlDatafeedAuthorization
  aggregations?: Record<string, AggregationsAggregationContainer>
  chunking_config: MlChunkingConfig
  delayed_data_check_config?: MlDelayedDataCheckConfig
  datafeed_id: <<shared-type-id, Id>>
  frequency?: <<shared-type-duration, Duration>>
  indices: string[]
  indices_options?: <<shared-type-indices-options, IndicesOptions>>
  job_id: <<shared-type-id, Id>>
  max_empty_searches?: <<shared-type-integer, integer>>
  query: QueryDslQueryContainer
  query_delay: <<shared-type-duration, Duration>>
  runtime_mappings?: MappingRuntimeFields
  script_fields?: Record<string, <<shared-type-script-field, ScriptField>>>
  scroll_size: <<shared-type-integer, integer>>
}
----

