WARNING: Version 6.2 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
This API enables you to preview a datafeed.
The preview datafeeds API returns the first "page" of results from the search
that is created by using the current datafeed settings. This preview 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
Security Privileges.
When X-Pack security is enabled, the datafeed query will be previewed using the credentials of the user calling the preview datafeed API. When the datafeed 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 datafeed will return when started. To avoid such problems, the same user that creates/updates the datafeed should preview it to ensure it is returning the expected data.
The following example obtains a preview of the datafeed-farequote
datafeed:
GET _xpack/ml/datafeeds/datafeed-farequote/_preview
The data that is returned for this example is as follows:
[ { "@timestamp": 1454803200000, "airline": "AAL", "responsetime": 132.20460510253906 }, { "@timestamp": 1454803200000, "airline": "JZA", "responsetime": 990.4628295898438 }, { "@timestamp": 1454803200000, "airline": "JBU", "responsetime": 877.5927124023438 }, ... ]