preview-datafeed.asciidoc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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>> and {ml-docs-setup-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 or updates the {dfeed} should preview
  29. it to ensure it is returning the expected data. Alternatively, use
  30. <<http-clients-secondary-authorization,secondary authorization headers>> to
  31. supply the credentials.
  32. [[ml-preview-datafeed-path-parms]]
  33. == {api-path-parms-title}
  34. `<datafeed_id>`::
  35. (Required, string)
  36. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=datafeed-id]
  37. [[ml-preview-datafeed-example]]
  38. == {api-examples-title}
  39. [source,console]
  40. --------------------------------------------------
  41. GET _ml/datafeeds/datafeed-high_sum_total_sales/_preview
  42. --------------------------------------------------
  43. // TEST[skip:set up Kibana sample data]
  44. The data that is returned for this example is as follows:
  45. [source,console-result]
  46. ----
  47. [
  48. {
  49. "order_date" : 1574294659000,
  50. "category.keyword" : "Men's Clothing",
  51. "customer_full_name.keyword" : "Sultan Al Benson",
  52. "taxful_total_price" : 35.96875
  53. },
  54. {
  55. "order_date" : 1574294918000,
  56. "category.keyword" : [
  57. "Women's Accessories",
  58. "Women's Clothing"
  59. ],
  60. "customer_full_name.keyword" : "Pia Webb",
  61. "taxful_total_price" : 83.0
  62. },
  63. {
  64. "order_date" : 1574295782000,
  65. "category.keyword" : [
  66. "Women's Accessories",
  67. "Women's Shoes"
  68. ],
  69. "customer_full_name.keyword" : "Brigitte Graham",
  70. "taxful_total_price" : 72.0
  71. }
  72. ]
  73. ----