Files
elasticsearch-js/docs/reference-ml-put_datafeed.asciidoc

108 lines
5.8 KiB
Plaintext

[[reference-ml-put_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.putDatafeed]]
=== client.ml.putDatafeed
Create a datafeed. Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. You can associate only one datafeed with each anomaly detection job. The datafeed contains a query that runs at a defined interval (`frequency`). If you are concerned about delayed data, you can add a delay (`query_delay') at each interval. When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead. You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed directly to the `.ml-config` index. Do not give users `write` privileges on the `.ml-config` index.
{ref}/ml-put-datafeed.html[{es} documentation]
[discrete]
==== Function signature
[source,ts]
----
(MlPutDatafeedRequest, options?): Promise<MlPutDatafeedResponse>
----
[discrete]
==== MlPutDatafeedRequest
[pass]
++++
<pre>
++++
interface MlPutDatafeedRequest extends <<RequestBase>> {
datafeed_id: <<Id>>
allow_no_indices?: boolean
expand_wildcards?: <<ExpandWildcards>>
ignore_throttled?: boolean
ignore_unavailable?: boolean
aggregations?: Record<string, <<AggregationsAggregationContainer>>>
chunking_config?: <<MlChunkingConfig>>
delayed_data_check_config?: <<MlDelayedDataCheckConfig>>
frequency?: <<Duration>>
indices?: <<Indices>>
pass:[/**] @alias indices */
indexes?: <<Indices>>
indices_options?: <<IndicesOptions>>
job_id?: <<Id>>
max_empty_searches?: <<integer>>
query?: <<QueryDslQueryContainer>>
query_delay?: <<Duration>>
runtime_mappings?: <<MappingRuntimeFields>>
script_fields?: Record<string, <<ScriptField>>>
scroll_size?: <<integer>>
headers?: <<HttpHeaders>>
}
[pass]
++++
</pre>
++++
[discrete]
==== MlPutDatafeedResponse
[pass]
++++
<pre>
++++
interface MlPutDatafeedResponse {
aggregations?: Record<string, <<AggregationsAggregationContainer>>>
authorization?: <<MlDatafeedAuthorization>>
chunking_config: <<MlChunkingConfig>>
delayed_data_check_config?: <<MlDelayedDataCheckConfig>>
datafeed_id: <<Id>>
frequency?: <<Duration>>
indices: string[]
job_id: <<Id>>
indices_options?: <<IndicesOptions>>
max_empty_searches?: <<integer>>
query: <<QueryDslQueryContainer>>
query_delay: <<Duration>>
runtime_mappings?: <<MappingRuntimeFields>>
script_fields?: Record<string, <<ScriptField>>>
scroll_size: <<integer>>
}
[pass]
++++
</pre>
++++