1
0

preview-datafeed.asciidoc 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. [[ml-preview-datafeed-request]]
  11. ==== {api-request-title}
  12. `GET _ml/datafeeds/<datafeed_id>/_preview`
  13. [[ml-preview-datafeed-prereqs]]
  14. ==== {api-prereq-title}
  15. * If {es} {security-features} are enabled, you must have `monitor_ml`, `monitor`,
  16. `manage_ml`, or `manage` cluster privileges to use this API. See
  17. <<security-privileges>>.
  18. [[ml-preview-datafeed-desc]]
  19. ==== {api-description-title}
  20. The preview {dfeeds} API returns the first "page" of results from the `search`
  21. that is created by using the current {dfeed} settings. This preview shows the
  22. structure of the data that will be passed to the anomaly detection engine.
  23. IMPORTANT: When {es} {security-features} are enabled, the {dfeed} query is
  24. previewed using the credentials of the user calling the preview {dfeed} API.
  25. When the {dfeed} is started it runs the query using the roles of the last user
  26. to create or update it. If the two sets of roles differ then the preview may
  27. not accurately reflect what the {dfeed} will return when started. To avoid
  28. such problems, the same user that creates/updates the {dfeed} should preview
  29. it to ensure it is returning the expected data.
  30. +
  31. --
  32. NOTE: It is possible that secondary authorization headers are supplied in the
  33. request. If this is the case, the secondary authorization headers are used
  34. instead of the primary headers.
  35. --
  36. [[ml-preview-datafeed-path-parms]]
  37. ==== {api-path-parms-title}
  38. `<datafeed_id>`::
  39. (Required, string)
  40. include::{docdir}/ml/ml-shared.asciidoc[tag=datafeed-id]
  41. [[ml-preview-datafeed-example]]
  42. ==== {api-examples-title}
  43. [source,console]
  44. --------------------------------------------------
  45. GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview
  46. --------------------------------------------------
  47. // TEST[skip:set up Kibana sample data]
  48. The data that is returned for this example is as follows:
  49. [source,console-result]
  50. ----
  51. [
  52. {
  53. "order_date" : 1574294659000,
  54. "category.keyword" : "Men's Clothing",
  55. "customer_full_name.keyword" : "Sultan Al Benson",
  56. "taxful_total_price" : 35.96875
  57. },
  58. {
  59. "order_date" : 1574294918000,
  60. "category.keyword" : [
  61. "Women's Accessories",
  62. "Women's Clothing"
  63. ],
  64. "customer_full_name.keyword" : "Pia Webb",
  65. "taxful_total_price" : 83.0
  66. },
  67. {
  68. "order_date" : 1574295782000,
  69. "category.keyword" : [
  70. "Women's Accessories",
  71. "Women's Shoes"
  72. ],
  73. "customer_full_name.keyword" : "Brigitte Graham",
  74. "taxful_total_price" : 72.0
  75. }
  76. ]
  77. ----