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
|
2019-10-07 18:23:19 -04:00
|
|
|
<<security-privileges>>.
|
2019-06-27 16:58:42 -04:00
|
|
|
|
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
|
2020-04-29 19:29:38 -04:00
|
|
|
to create or update it. If the two sets of roles differ then the preview may
|
2019-06-27 16:58:42 -04:00
|
|
|
not accurately reflect what the {dfeed} will return when started. To avoid
|
2020-04-29 19:29:38 -04:00
|
|
|
such problems, the same user that creates or updates the {dfeed} should preview
|
|
|
|
it to ensure it is returning the expected data. Alternatively, use
|
|
|
|
<<http-clients-secondary-authorization,secondary authorization headers>> to
|
|
|
|
supply the credentials.
|
2019-06-27 16:58:42 -04:00
|
|
|
|
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>`::
|
2019-12-30 12:35:16 -05:00
|
|
|
(Required, string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=datafeed-id]
|
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
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2017-04-04 18:26:39 -04:00
|
|
|
--------------------------------------------------
|
2019-12-30 12:35:16 -05:00
|
|
|
GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview
|
2017-04-04 18:26:39 -04:00
|
|
|
--------------------------------------------------
|
2019-12-30 12:35:16 -05:00
|
|
|
// TEST[skip:Kibana sample data]
|
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:
|
2019-09-06 09:22:08 -04:00
|
|
|
|
|
|
|
[source,console-result]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
2017-04-10 11:59:27 -04:00
|
|
|
[
|
|
|
|
{
|
2019-12-30 12:35:16 -05:00
|
|
|
"order_date" : 1575504259000,
|
|
|
|
"category.keyword" : "Men's Clothing",
|
|
|
|
"customer_full_name.keyword" : "Sultan Al Benson",
|
|
|
|
"taxful_total_price" : 35.96875
|
2017-04-10 11:59:27 -04:00
|
|
|
},
|
|
|
|
{
|
2019-12-30 12:35:16 -05:00
|
|
|
"order_date" : 1575504518000,
|
|
|
|
"category.keyword" : [
|
|
|
|
"Women's Accessories",
|
|
|
|
"Women's Clothing"
|
|
|
|
],
|
|
|
|
"customer_full_name.keyword" : "Pia Webb",
|
|
|
|
"taxful_total_price" : 83.0
|
2017-04-10 11:59:27 -04:00
|
|
|
},
|
2018-06-21 14:32:11 -04:00
|
|
|
{
|
2019-12-30 12:35:16 -05:00
|
|
|
"order_date" : 1575505382000,
|
|
|
|
"category.keyword" : [
|
|
|
|
"Women's Accessories",
|
|
|
|
"Women's Shoes"
|
|
|
|
],
|
|
|
|
"customer_full_name.keyword" : "Brigitte Graham",
|
|
|
|
"taxful_total_price" : 72.0
|
|
|
|
},
|
|
|
|
...
|
2017-04-10 11:59:27 -04:00
|
|
|
]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|