preview-datafeed.asciidoc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-preview-datafeed]]
  4. === Preview {dfeeds} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Preview {dfeeds}</titleabbrev>
  8. ++++
  9. Previews a {dfeed}.
  10. ==== Request
  11. `GET _ml/datafeeds/<datafeed_id>/_preview`
  12. ==== Description
  13. The preview {dfeeds} API returns the first "page" of results from the `search`
  14. that is created by using the current {dfeed} settings. This preview shows the
  15. structure of the data that will be passed to the anomaly detection engine.
  16. ==== Path Parameters
  17. `datafeed_id` (required)::
  18. (string) Identifier for the {dfeed}
  19. ==== Authorization
  20. If {es} {security-features} are enabled, you must have `monitor_ml`, `monitor`,
  21. `manage_ml`, or `manage` cluster privileges to use this API. For more
  22. information, see
  23. {stack-ov}/security-privileges.html[Security Privileges].
  24. ==== Security Integration
  25. When {es} {security-features} are enabled, the {dfeed} query is previewed using
  26. the credentials of the user calling the preview {dfeed} API. When the {dfeed}
  27. is started it runs the query using the roles of the last user to
  28. create or update it. If the two sets of roles differ then the preview may
  29. not accurately reflect what the {dfeed} will return when started. To avoid
  30. such problems, the same user that creates/updates the {dfeed} should preview
  31. it to ensure it is returning the expected data.
  32. ==== Examples
  33. The following example obtains a preview of the `datafeed-farequote` {dfeed}:
  34. [source,js]
  35. --------------------------------------------------
  36. GET _ml/datafeeds/datafeed-farequote/_preview
  37. --------------------------------------------------
  38. // CONSOLE
  39. // TEST[skip:setup:farequote_datafeed]
  40. The data that is returned for this example is as follows:
  41. [source,js]
  42. ----
  43. [
  44. {
  45. "time": 1454803200000,
  46. "airline": "JZA",
  47. "doc_count": 5,
  48. "responsetime": 990.4628295898438
  49. },
  50. {
  51. "time": 1454803200000,
  52. "airline": "JBU",
  53. "doc_count": 23,
  54. "responsetime": 877.5927124023438
  55. },
  56. {
  57. "time": 1454803200000,
  58. "airline": "KLM",
  59. "doc_count": 42,
  60. "responsetime": 1355.481201171875
  61. }
  62. ]
  63. ----
  64. // TESTRESPONSE