2017-04-11 21:52:47 -04:00
|
|
|
//lcawley Verified example output 2017-04-11
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-put-datafeed]]
|
|
|
|
==== Create Data Feeds
|
|
|
|
|
2017-04-10 11:59:27 -04:00
|
|
|
The create data feed API enables you to instantiate a data feed.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Request
|
|
|
|
|
|
|
|
`PUT _xpack/ml/datafeeds/<feed_id>`
|
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Description
|
|
|
|
|
2017-04-10 11:59:27 -04:00
|
|
|
You must create a job before you create a data feed. You can associate only one
|
|
|
|
data feed to each job.
|
|
|
|
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Path Parameters
|
|
|
|
|
|
|
|
`feed_id` (required)::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) A numerical character string that uniquely identifies the data feed.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Request Body
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`aggregations`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(object) TBD.
|
2017-04-11 21:52:47 -04:00
|
|
|
|
|
|
|
`chunking_config`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(object) TBD.
|
2017-04-11 21:52:47 -04:00
|
|
|
For example: {"mode": "manual", "time_span": "30000000ms"}
|
2017-04-10 11:59:27 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`frequency`::
|
2017-04-10 11:59:27 -04:00
|
|
|
TBD: For example: "150s"
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`indexes` (required)::
|
2017-04-11 22:26:18 -04:00
|
|
|
(array) An array of index names. For example: ["it_ops_metrics"]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`job_id` (required)::
|
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-11 22:26:18 -04:00
|
|
|
(object) The query that retrieves the data.
|
2017-04-10 11:59:27 -04:00
|
|
|
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-10 11:59:27 -04:00
|
|
|
TBD. For example: "60s"
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`scroll_size`::
|
2017-04-10 11:59:27 -04:00
|
|
|
TBD. For example, 1000
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`types` (required)::
|
2017-04-10 11:59:27 -04:00
|
|
|
TBD. For example: ["network","sql","kpi"]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 11:59:27 -04:00
|
|
|
For more information about these properties,
|
2017-04-11 21:52:47 -04:00
|
|
|
see <<ml-datafeed-resource, Data Feed Resources>>.
|
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-04 18:26:39 -04:00
|
|
|
|
|
|
|
===== Examples
|
|
|
|
|
2017-04-10 11:59:27 -04:00
|
|
|
The following example creates the `datafeed-it-ops-kpi` data feed:
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2017-04-10 11:59:27 -04:00
|
|
|
PUT _xpack/ml/datafeeds/datafeed-it-ops-kpi
|
2017-04-04 18:26:39 -04:00
|
|
|
{
|
2017-04-10 11:59:27 -04:00
|
|
|
"job_id": "it-ops-kpi",
|
2017-04-11 21:52:47 -04:00
|
|
|
"indexes": ["it_ops_metrics"],
|
|
|
|
"types": ["kpi","network","sql"],
|
|
|
|
"query": {
|
|
|
|
"match_all": {
|
|
|
|
"boost": 1
|
|
|
|
}
|
|
|
|
}
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
2017-04-10 11:59:27 -04:00
|
|
|
When the data feed is created, you receive the following results:
|
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-04-10 11:59:27 -04:00
|
|
|
"query_delay": "1m",
|
|
|
|
"indexes": [
|
|
|
|
"it_ops_metrics"
|
|
|
|
],
|
|
|
|
"types": [
|
|
|
|
"kpi",
|
2017-04-11 21:52:47 -04:00
|
|
|
"network",
|
|
|
|
"sql"
|
2017-04-10 11:59:27 -04:00
|
|
|
],
|
|
|
|
"query": {
|
|
|
|
"match_all": {
|
|
|
|
"boost": 1
|
|
|
|
}
|
2017-04-04 18:26:39 -04:00
|
|
|
},
|
2017-04-11 21:52:47 -04:00
|
|
|
"scroll_size": 1000,
|
|
|
|
"chunking_config": {
|
|
|
|
"mode": "auto"
|
|
|
|
}
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
----
|