preview-datafeed.asciidoc 2.0 KB

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