--
:api: preview-datafeed
:request: PreviewDatafeedRequest
:response: PreviewDatafeedResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Preview datafeeds API

Previews a {ml} datafeed's data in the cluster. It accepts a +{request}+ object
and responds with a +{response}+ object.

[id="{upid}-{api}-request"]
==== Preview datafeeds request

A +{request}+ object is created referencing a non-null `datafeedId`.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Constructing a new request referencing an existing `datafeedId`

[id="{upid}-{api}-response"]
==== Preview datafeeds response

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The raw +BytesReference+ of the data preview
<2> A +List<Map<String,Object>>+ that represents the previewed data

include::../execution.asciidoc[]
