2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
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
|
|
|
|
2017-05-02 15:45:42 -04:00
|
|
|
The preview {dfeed} API enables you to preview 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
|
|
|
|
2017-04-24 13:46:17 -04:00
|
|
|
The API returns the first "page" of results from the `search` that is created
|
2017-05-02 15:45:42 -04:00
|
|
|
by using the current {dfeed} settings. This preview shows the structure of
|
2017-04-24 13:46:17 -04:00
|
|
|
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].
|
|
|
|
//<<privileges-list-cluster>>.
|
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
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
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
|
|
|
[
|
|
|
|
{
|
|
|
|
"@timestamp": 1454803200000,
|
2017-04-11 21:52:47 -04:00
|
|
|
"airline": "AAL",
|
2017-04-10 11:59:27 -04:00
|
|
|
"responsetime": 132.20460510253906
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"@timestamp": 1454803200000,
|
2017-04-11 21:52:47 -04:00
|
|
|
"airline": "JZA",
|
2017-04-10 11:59:27 -04:00
|
|
|
"responsetime": 990.4628295898438
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"@timestamp": 1454803200000,
|
2017-04-11 21:52:47 -04:00
|
|
|
"airline": "JBU",
|
2017-04-10 11:59:27 -04:00
|
|
|
"responsetime": 877.5927124023438
|
|
|
|
},
|
2017-04-04 18:26:39 -04:00
|
|
|
...
|
2017-04-10 11:59:27 -04:00
|
|
|
]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|