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]]
|
2017-12-14 13:52:49 -05:00
|
|
|
=== Preview {dfeeds-cap} API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Preview {dfeeds-cap}</titleabbrev>
|
|
|
|
++++
|
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
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Request
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-24 12:31:31 -04:00
|
|
|
`GET _xpack/ml/datafeeds/<datafeed_id>/_preview`
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 11:59:27 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Description
|
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
|
|
|
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Path Parameters
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-24 12:31:31 -04:00
|
|
|
`datafeed_id` (required)::
|
2017-05-02 15:45:42 -04:00
|
|
|
(string) Identifier for the {dfeed}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Authorization
|
2017-04-25 17:08:29 -04:00
|
|
|
|
|
|
|
You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
|
2017-06-19 21:23:58 -04:00
|
|
|
privileges to use this API. For more information, see
|
|
|
|
{xpack-ref}/security-privileges.html[Security Privileges].
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
|
2017-12-15 09:41:10 -05:00
|
|
|
==== Security Integration
|
|
|
|
|
|
|
|
When {security} is enabled, the {dfeed} query will be previewed using the
|
|
|
|
credentials of the user calling the preview {dfeed} API. When the {dfeed}
|
|
|
|
is started it will run 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.
|
|
|
|
|
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Examples
|
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]
|
|
|
|
--------------------------------------------------
|
2017-04-10 11:59:27 -04:00
|
|
|
GET _xpack/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
|