OpenSearch/docs/en/rest-api/ml/preview-datafeed.asciidoc

75 lines
1.7 KiB
Plaintext
Raw Normal View History

//lcawley: Verified example output 2017-04-11
[[ml-preview-datafeed]]
==== Preview Data Feeds
The preview data feed API enables you to preview a data feed.
===== Request
`GET _xpack/ml/datafeeds/<datafeed_id>/_preview`
===== Description
The API returns the first "page" of results from the `search` created using the current data feed settings.
This shows the structure of the data that will be passed to the anomaly detection engine.
You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
privileges to use this API. For more information, see <<privileges-list-cluster>>.
===== Path Parameters
`datafeed_id` (required)::
(string) Identifier for the data feed
////
===== Request Body
None
===== Responses
TBD
////
////
200
(EmptyResponse) The cluster has been successfully deleted
404
(BasicFailedReply) The cluster specified by {cluster_id} cannot be found (code: clusters.cluster_not_found)
412
(BasicFailedReply) The Elasticsearch cluster has not been shutdown yet (code: clusters.cluster_plan_state_error)
////
===== Examples
The following example obtains a preview of the `datafeed-farequote` data feed:
[source,js]
--------------------------------------------------
GET _xpack/ml/datafeeds/datafeed-farequote/_preview
--------------------------------------------------
// CONSOLE
// TEST[skip:todo]
The data that is returned for this example is as follows:
[source,js]
----
[
{
"@timestamp": 1454803200000,
"airline": "AAL",
"responsetime": 132.20460510253906
},
{
"@timestamp": 1454803200000,
"airline": "JZA",
"responsetime": 990.4628295898438
},
{
"@timestamp": 1454803200000,
"airline": "JBU",
"responsetime": 877.5927124023438
},
...
]
----