| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | [role="xpack"][testenv="platinum"][[ml-preview-datafeed]]=== Preview {dfeeds-cap} API++++<titleabbrev>Preview {dfeeds-cap}</titleabbrev>++++Previews a {dfeed}.==== Request`GET _xpack/ml/datafeeds/<datafeed_id>/_preview`==== DescriptionThe preview {dfeeds} API returns the first "page" of results from the `search`that is created by using the current {dfeed} settings. This preview shows thestructure of the data that will be passed to the anomaly detection engine.==== Path Parameters`datafeed_id` (required)::  (string) Identifier for the {dfeed}==== AuthorizationYou must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` clusterprivileges to use this API. For more information, see{xpack-ref}/security-privileges.html[Security Privileges].==== Security IntegrationWhen {security} is enabled, the {dfeed} query will be previewed using thecredentials 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 tocreate or update it.  If the two sets of roles differ then the preview maynot accurately reflect what the {dfeed} will return when started.  To avoidsuch problems, the same user that creates/updates the {dfeed} should previewit to ensure it is returning the expected data.==== ExamplesThe following example obtains a preview of the `datafeed-farequote` {dfeed}:[source,js]--------------------------------------------------GET _xpack/ml/datafeeds/datafeed-farequote/_preview--------------------------------------------------// CONSOLE// TEST[skip:setup:farequote_datafeed]The data that is returned for this example is as follows:[source,js]----[  {    "time": 1454803200000,    "airline": "JZA",    "doc_count": 5,    "responsetime": 990.4628295898438  },  {    "time": 1454803200000,    "airline": "JBU",    "doc_count": 23,    "responsetime": 877.5927124023438  },  {    "time": 1454803200000,    "airline": "KLM",    "doc_count": 42,    "responsetime": 1355.481201171875  }]----// TESTRESPONSE
 |