2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2018-08-31 19:49:24 -04:00
|
|
|
[testenv="platinum"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-update-datafeed]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Update {dfeeds} API
|
2019-04-30 13:46:13 -04:00
|
|
|
|
|
|
|
[subs="attributes"]
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Update {dfeeds}</titleabbrev>
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-06-13 16:37:35 -04:00
|
|
|
Updates certain properties of a {dfeed}.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-10-03 07:12:19 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-update-datafeed-request]]
|
|
|
|
==== {api-request-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`POST _ml/datafeeds/<feed_id>/_update`
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-10-03 07:12:19 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
[[ml-update-datafeed-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* If {es} {security-features} are enabled, you must have `manage_ml`, or `manage`
|
|
|
|
cluster privileges to use this API. See
|
2019-10-07 18:23:19 -04:00
|
|
|
<<security-privileges>>.
|
2019-06-27 16:58:42 -04:00
|
|
|
|
2019-10-03 07:12:19 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-update-datafeed-desc]]
|
|
|
|
==== {api-description-title}
|
2019-05-28 11:36:30 -04:00
|
|
|
|
2019-10-04 02:42:30 -04:00
|
|
|
If you update a {dfeed} property, you must stop and start the {dfeed} for the
|
2019-10-03 07:12:19 -04:00
|
|
|
change to be applied.
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
IMPORTANT: When {es} {security-features} are enabled, your {dfeed} remembers
|
|
|
|
which roles the user who updated it had at the time of update and runs the query
|
|
|
|
using those same roles.
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-update-datafeed-path-parms]]
|
|
|
|
==== {api-path-parms-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<feed_id>`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Required, string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=datafeed-id]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-update-datafeed-request-body]]
|
|
|
|
==== {api-request-body-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-05-02 15:45:42 -04:00
|
|
|
The following properties can be updated after the {dfeed} is created:
|
2017-04-10 11:59:27 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`aggregations`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=aggregations]
|
2017-04-11 21:52:47 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`chunking_config`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=chunking-config]
|
2019-05-28 11:36:30 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`delayed_data_check_config`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`frequency`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, <<time-units, time units>>)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=frequency]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`indices`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, array)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=indices]
|
|
|
|
|
|
|
|
`max_empty_searches`::
|
|
|
|
(Optional, integer)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=max-empty-searches]
|
|
|
|
+
|
|
|
|
--
|
|
|
|
The special value `-1` unsets this setting.
|
|
|
|
--
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`query`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=query]
|
2019-10-03 07:12:19 -04:00
|
|
|
+
|
|
|
|
--
|
2019-12-27 16:30:26 -05:00
|
|
|
WARNING: If you change the query, the analyzed data is also changed. Therefore,
|
|
|
|
the required time to learn might be long and the understandability of the
|
|
|
|
results is unpredictable. If you want to make significant changes to the source
|
|
|
|
data, we would recommend you clone it and create a second job containing the
|
|
|
|
amendments. Let both run in parallel and close one when you are satisfied with
|
|
|
|
the results of the other job.
|
|
|
|
|
2019-10-03 07:12:19 -04:00
|
|
|
--
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`query_delay`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, <<time-units, time units>>)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=query-delay]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`script_fields`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=script-fields]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`scroll_size`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, unsigned integer)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=scroll-size]
|
2019-10-03 07:12:19 -04:00
|
|
|
|
2017-04-10 11:59:27 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-update-datafeed-example]]
|
|
|
|
==== {api-examples-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-09-09 12:35:50 -04:00
|
|
|
[source,console]
|
2017-04-04 18:26:39 -04:00
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
POST _ml/datafeeds/datafeed-total-requests/_update
|
2017-04-04 18:26:39 -04:00
|
|
|
{
|
2017-05-03 11:38:31 -04:00
|
|
|
"query": {
|
|
|
|
"term": {
|
|
|
|
"level": "error"
|
|
|
|
}
|
2017-04-11 21:52:47 -04:00
|
|
|
}
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2018-08-31 19:49:24 -04:00
|
|
|
// TEST[skip:setup:server_metrics_datafeed]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-10-03 07:12:19 -04:00
|
|
|
|
2017-05-03 12:07:44 -04:00
|
|
|
When the {dfeed} is updated, you receive the full {dfeed} configuration with
|
2017-05-03 11:38:31 -04:00
|
|
|
with the updated values:
|
2017-05-03 12:07:44 -04:00
|
|
|
|
2019-09-06 16:09:09 -04:00
|
|
|
[source,console-result]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
2018-02-20 14:08:37 -05:00
|
|
|
"datafeed_id": "datafeed-total-requests",
|
|
|
|
"job_id": "total-requests",
|
|
|
|
"query_delay": "83474ms",
|
|
|
|
"indices": ["server-metrics"],
|
2017-05-03 11:38:31 -04:00
|
|
|
"query": {
|
|
|
|
"term": {
|
|
|
|
"level": {
|
|
|
|
"value": "error",
|
2018-02-20 14:08:37 -05:00
|
|
|
"boost": 1.0
|
2017-04-10 11:59:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2017-04-11 21:52:47 -04:00
|
|
|
"scroll_size": 1000,
|
|
|
|
"chunking_config": {
|
2017-05-03 11:38:31 -04:00
|
|
|
"mode": "auto"
|
2017-04-11 21:52:47 -04:00
|
|
|
}
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
----
|
2018-02-20 14:08:37 -05:00
|
|
|
// TESTRESPONSE[s/"query.boost": "1.0"/"query.boost": $body.query.boost/]
|