2017-04-11 21:52:47 -04:00
|
|
|
//lcawley Verified example output 2017-04
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-update-datafeed]]
|
2017-05-02 15:45:42 -04:00
|
|
|
==== Update {dfeeds-cap}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-05-02 15:45:42 -04:00
|
|
|
The update {dfeed} API enables you to update certain properties of a {dfeed}.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
===== Request
|
|
|
|
|
|
|
|
`POST _xpack/ml/datafeeds/<feed_id>/_update`
|
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
//===== Description
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Path Parameters
|
|
|
|
|
|
|
|
`feed_id` (required)::
|
2017-05-02 15:45:42 -04:00
|
|
|
(string) Identifier for the {dfeed}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
===== Request Body
|
|
|
|
|
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
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`aggregations`::
|
2017-05-02 15:45:42 -04:00
|
|
|
(object) If set, the {dfeed} performs aggregation searches.
|
2017-04-26 14:18:51 -04:00
|
|
|
For more information, see <<ml-datafeed-resource>>.
|
2017-04-11 21:52:47 -04:00
|
|
|
|
|
|
|
`chunking_config`::
|
2017-04-27 14:17:06 -04:00
|
|
|
(object) Specifies how data searches are split into time chunks.
|
|
|
|
See <<ml-datafeed-chunking-config>>.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`frequency`::
|
2017-05-02 15:45:42 -04:00
|
|
|
(time units) The interval at which scheduled queries are made while the
|
|
|
|
{dfeed} runs in real time. The default value is either the bucket span for short
|
2017-04-26 14:18:51 -04:00
|
|
|
bucket spans, or, for longer bucket spans, a sensible fraction of the bucket
|
2017-05-15 12:30:30 -04:00
|
|
|
span. For example: `150s`.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-05-04 06:37:12 -04:00
|
|
|
`indices`::
|
2017-05-03 12:07:44 -04:00
|
|
|
(array) An array of index names. Wildcards are supported. For example:
|
2017-05-15 12:30:30 -04:00
|
|
|
`["it_ops_metrics", "server*"]`.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`job_id`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) A numerical character string that uniquely identifies the job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`query`::
|
2017-04-27 14:17:06 -04:00
|
|
|
(object) The {es} query domain-specific language (DSL). This value
|
|
|
|
corresponds to the query object in an {es} search POST body. All the
|
|
|
|
options that are supported by {es} can be used, as this object is
|
|
|
|
passed verbatim to {es}. By default, this property has the following
|
|
|
|
value: `{"match_all": {"boost": 1}}`.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`query_delay`::
|
2017-04-26 14:18:51 -04:00
|
|
|
(time units) The number of seconds behind real-time that data is queried. For
|
2017-04-27 14:17:06 -04:00
|
|
|
example, if data from 10:04 a.m. might not be searchable in {es} until
|
|
|
|
10:06 a.m., set this property to 120 seconds. The default value is `60s`.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-05-15 12:30:30 -04:00
|
|
|
`script_fields`::
|
|
|
|
(object) Specifies scripts that evaluate custom expressions and returns
|
|
|
|
script fields to the {dfeed}.
|
|
|
|
The <<ml-detectorconfig,detector configuration objects>> in a job can contain
|
|
|
|
functions that use these script fields.
|
|
|
|
For more information,
|
|
|
|
see {ref}/search-request-script-fields.html[Script Fields].
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`scroll_size`::
|
2017-04-27 14:17:06 -04:00
|
|
|
(unsigned integer) The `size` parameter that is used in {es} searches.
|
2017-04-26 14:18:51 -04:00
|
|
|
The default value is `1000`.
|
2017-04-10 11:59:27 -04:00
|
|
|
|
2017-05-03 11:38:31 -04:00
|
|
|
`types`::
|
2017-04-26 14:18:51 -04:00
|
|
|
(array) A list of types to search for within the specified indices.
|
2017-05-15 12:30:30 -04:00
|
|
|
For example: `["network","sql","kpi"]`.
|
2017-04-10 11:59:27 -04:00
|
|
|
|
|
|
|
For more information about these properties,
|
2017-05-02 15:45:42 -04:00
|
|
|
see <<ml-datafeed-resource>>.
|
2017-04-10 11:59:27 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
===== Authorization
|
|
|
|
|
|
|
|
You must have `manage_ml`, or `manage` cluster privileges to use this API.
|
|
|
|
For more information, see <<privileges-list-cluster>>.
|
2017-04-10 11:59:27 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Examples
|
|
|
|
|
2017-05-03 12:07:44 -04:00
|
|
|
The following example updates the query for the `datafeed-it-ops-kpi` {dfeed}
|
|
|
|
so that only log entries of error level are analyzed:
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2017-04-11 21:52:47 -04:00
|
|
|
POST _xpack/ml/datafeeds/datafeed-it-ops-kpi/_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
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
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
|
|
|
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
2017-04-10 11:59:27 -04:00
|
|
|
"datafeed_id": "datafeed-it-ops-kpi",
|
2017-04-04 18:26:39 -04:00
|
|
|
"job_id": "it-ops-kpi",
|
2017-05-03 11:38:31 -04:00
|
|
|
"query_delay": "1m",
|
2017-05-04 06:37:12 -04:00
|
|
|
"indices": ["it-ops"],
|
2017-05-03 11:38:31 -04:00
|
|
|
"types": ["logs"],
|
|
|
|
"query": {
|
|
|
|
"term": {
|
|
|
|
"level": {
|
|
|
|
"value": "error",
|
|
|
|
"boost": 1
|
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
|
|
|
}
|
|
|
|
----
|