Update a datafeed
- POST /_ml/datafeeds/{datafeed_id}/_update
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.
- Cluster privileges:
manage_ml
Path Parameters
-
datafeed_idstring Idrequired -
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.
Query Parameters
-
allow_no_indicesboolean · default: true If
true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the_allstring or when no indices are specified.-
expand_wildcardsstring ExpandWildcards · default: open 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.
Supported values include:
all: Match any data stream or index, including hidden ones.open: Match open, non-hidden indices. Also matches any non-hidden data stream.closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.hidden: Match hidden data streams and hidden indices. Must be combined withopen,closed, orboth.none: Wildcard expressions are not accepted.
-
Values:
allopenclosedhiddennone -
ignore_throttledboolean · default: truedeprecated If
true, concrete, expanded or aliased indices are ignored when frozen.If
true, unavailable indices (missing or closed) are ignored.
Request
-
aggregationsmap string to AggregationContainer -
If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data.
-
chunking_configChunkingConfig -
Datafeeds might 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.
-
modeChunkingModerequired -
If the mode is
auto, the chunk size is dynamically calculated; this is the recommended value when the datafeed does not use aggregations. If the mode ismanual, chunking is applied according to the specifiedtime_span; use this mode when the datafeed uses aggregations. If the mode isoff, no chunking is applied. -
Values:
automanualoff -
time_spanstring Duration · default: 3h -
The time span that each search will be querying. This setting is applicable only when the
modeis set tomanual. -
delayed_data_check_configDelayedDataCheckConfig -
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_delayis 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. -
check_windowstring Duration -
The window of time that is searched for late data. This window of time ends with the latest finalized bucket. It defaults to null, which causes an appropriate
check_windowto be calculated when the real-time datafeed runs. In particular, the defaultcheck_windowspan calculation is based on the maximum of2hor8 * bucket_span. -
enabledbooleanrequired -
Specifies whether the datafeed periodically checks for delayed data.
-
frequencystring Duration -
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
frequencyis 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. -
indicesstring -
An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the
remote_cluster_clientrole. -
indices_optionsIndicesOptions -
Specifies index expansion options that are used during search.
-
allow_no_indicesboolean -
If false, the request returns an error if any wildcard expression, index alias, or
_allvalue targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*returns an error if an index starts withfoobut no index starts withbar. -
expand_wildcardsstring ExpandWildcards -
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, such as
open,hidden.Supported values include:
all: Match any data stream or index, including hidden ones.open: Match open, non-hidden indices. Also matches any non-hidden data stream.closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.hidden: Match hidden data streams and hidden indices. Must be combined withopen,closed, orboth.none: Wildcard expressions are not accepted.
-
Values:
allopenclosedhiddennone -
If true, missing or closed indices are not included in the response.
-
ignore_throttledboolean · default: true -
If true, concrete, expanded or aliased indices are ignored when frozen.
-
job_idstring Id -
max_empty_searchesnumber -
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
frequencytimesmax_empty_searchesof 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. -
queryQueryContainer · default: {"match_all": {"boost": 1}} -
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. Note that if you change the query, the analyzed data is also changed. Therefore, the time required to learn might be long and the understandability of the results is unpredictable. If you want to make significant changes to the source data, it is recommended that you clone the job and datafeed and make the amendments in the clone. Let both run in parallel and close one when you are satisfied with the results of the job.
-
query_delaystring Duration -
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
60sand120s. This randomness improves the query performance when there are multiple jobs running on the same node. -
runtime_mappingsRuntimeFields -
Specifies runtime fields for the datafeed search.
-
script_fieldsmap string to ScriptField -
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.
-
<string>ScriptField -
scriptstring Scriptrequired -
ignore_failureboolean -
scroll_sizenumber · default: 1000 -
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.
Response
-
If an API key was used for the most recent update to the datafeed, its name and identifier are listed in the response.
-
The identifier for the API key.
-
The name of the API key.
-
If a user ID was used for the most recent update to the datafeed, its roles at the time of the update are listed in the response.
-
If a service account was used for the most recent update to the datafeed, the account name is listed in the response.
-
aggregationsmap string to AggregationContainer -
chunking_configChunkingConfigrequired -
modeChunkingModerequired -
If the mode is
auto, the chunk size is dynamically calculated; this is the recommended value when the datafeed does not use aggregations. If the mode ismanual, chunking is applied according to the specifiedtime_span; use this mode when the datafeed uses aggregations. If the mode isoff, no chunking is applied. -
Values:
automanualoff -
time_spanstring Duration · default: 3h -
The time span that each search will be querying. This setting is applicable only when the
modeis set tomanual. -
delayed_data_check_configDelayedDataCheckConfig -
check_windowstring Duration -
The window of time that is searched for late data. This window of time ends with the latest finalized bucket. It defaults to null, which causes an appropriate
check_windowto be calculated when the real-time datafeed runs. In particular, the defaultcheck_windowspan calculation is based on the maximum of2hor8 * bucket_span. -
enabledbooleanrequired -
Specifies whether the datafeed periodically checks for delayed data.
-
datafeed_idstring Idrequired -
frequencystring Duration -
indicesstringrequired -
indices_optionsIndicesOptions -
allow_no_indicesboolean -
If false, the request returns an error if any wildcard expression, index alias, or
_allvalue targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targetingfoo*,bar*returns an error if an index starts withfoobut no index starts withbar. -
expand_wildcardsstring ExpandWildcards -
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, such as
open,hidden.Supported values include:
all: Match any data stream or index, including hidden ones.open: Match open, non-hidden indices. Also matches any non-hidden data stream.closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.hidden: Match hidden data streams and hidden indices. Must be combined withopen,closed, orboth.none: Wildcard expressions are not accepted.
-
Values:
allopenclosedhiddennone -
If true, missing or closed indices are not included in the response.
-
ignore_throttledboolean · default: true -
If true, concrete, expanded or aliased indices are ignored when frozen.
-
job_idstring Idrequired -
max_empty_searchesnumber -
queryQueryContainerrequired -
query_delaystring Durationrequired -
runtime_mappingsRuntimeFields -
script_fieldsmap string to ScriptField -
<string>ScriptField -
scriptstring Scriptrequired -
ignore_failureboolean -
scroll_sizenumberrequired