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-preview-datafeed]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Preview {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>Preview {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
|
|
|
Previews a {dfeed}.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-preview-datafeed-request]]
|
|
|
|
==== {api-request-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`GET _ml/datafeeds/<datafeed_id>/_preview`
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
[[ml-preview-datafeed-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* If {es} {security-features} are enabled, you must have `monitor_ml`, `monitor`,
|
|
|
|
`manage_ml`, or `manage` cluster privileges to use this API. See
|
|
|
|
{stack-ov}/security-privileges.html[Security privileges].
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-preview-datafeed-desc]]
|
|
|
|
==== {api-description-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-01-15 11:44:08 -05:00
|
|
|
The preview {dfeeds} API returns the first "page" of results from the `search`
|
|
|
|
that is created by using the current {dfeed} settings. This preview shows the
|
|
|
|
structure of the data that will be passed to the anomaly detection engine.
|
2017-04-10 11:59:27 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
IMPORTANT: When {es} {security-features} are enabled, the {dfeed} query is
|
|
|
|
previewed using the credentials of the user calling the preview {dfeed} API.
|
|
|
|
When the {dfeed} is started it runs the query using the roles of the last user
|
|
|
|
to create or update it. If the two sets of roles differ then the preview may
|
|
|
|
not accurately reflect what the {dfeed} will return when started. To avoid
|
|
|
|
such problems, the same user that creates/updates the {dfeed} should preview
|
|
|
|
it to ensure it is returning the expected data.
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-preview-datafeed-path-parms]]
|
|
|
|
==== {api-path-parms-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<datafeed_id>`::
|
|
|
|
(Required, string) Identifier for the {dfeed}.
|
2017-12-15 09:41:10 -05:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-preview-datafeed-example]]
|
|
|
|
==== {api-examples-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-05-02 15:45:42 -04:00
|
|
|
The following example obtains a preview of the `datafeed-farequote` {dfeed}:
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
GET _ml/datafeeds/datafeed-farequote/_preview
|
2017-04-04 18:26:39 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
2018-08-31 19:49:24 -04:00
|
|
|
// TEST[skip:setup:farequote_datafeed]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 11:59:27 -04:00
|
|
|
The data that is returned for this example is as follows:
|
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
|
|
|
[
|
|
|
|
{
|
2018-06-21 14:32:11 -04:00
|
|
|
"time": 1454803200000,
|
2017-04-11 21:52:47 -04:00
|
|
|
"airline": "JZA",
|
2018-06-21 14:32:11 -04:00
|
|
|
"doc_count": 5,
|
2017-04-10 11:59:27 -04:00
|
|
|
"responsetime": 990.4628295898438
|
|
|
|
},
|
|
|
|
{
|
2018-06-21 14:32:11 -04:00
|
|
|
"time": 1454803200000,
|
2017-04-11 21:52:47 -04:00
|
|
|
"airline": "JBU",
|
2018-06-21 14:32:11 -04:00
|
|
|
"doc_count": 23,
|
2017-04-10 11:59:27 -04:00
|
|
|
"responsetime": 877.5927124023438
|
|
|
|
},
|
2018-06-21 14:32:11 -04:00
|
|
|
{
|
|
|
|
"time": 1454803200000,
|
|
|
|
"airline": "KLM",
|
|
|
|
"doc_count": 42,
|
|
|
|
"responsetime": 1355.481201171875
|
|
|
|
}
|
2017-04-10 11:59:27 -04:00
|
|
|
]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
2018-06-21 14:32:11 -04:00
|
|
|
// TESTRESPONSE
|