preview-transform.asciidoc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[preview-data-frame-transform]]
  4. === Preview {dataframe-transforms} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Preview {dataframe-transforms}</titleabbrev>
  8. ++++
  9. beta[]
  10. Previews a {dataframe-transform}.
  11. ==== Request
  12. `POST _data_frame/transforms/_preview`
  13. //==== Description
  14. //==== Path Parameters
  15. ==== Request Body
  16. `source`:: The source index or index pattern.
  17. `pivot`:: Defines the pivot function `group by` fields and the aggregation to
  18. reduce the data.
  19. ==== Authorization
  20. If the {es} {security-features} are enabled, you must have
  21. `manage_data_frame_transforms` cluster privileges to use this API. The built-in
  22. `data_frame_transforms_admin` role has these privileges. You must also have
  23. `read` and `view_index_metadata` privileges on the source index for the
  24. {dataframe-transform}. For more information, see
  25. {stack-ov}/security-privileges.html[Security privileges] and
  26. {stack-ov}/built-in-roles.html[Built-in roles].
  27. ==== Examples
  28. The following example obtains a preview of a {dataframe-transform} on the {kib}
  29. eCommerce sample data:
  30. [source,js]
  31. --------------------------------------------------
  32. POST _data_frame/transforms/_preview
  33. {
  34. "source": {
  35. "index": "kibana_sample_data_ecommerce"
  36. },
  37. "pivot": {
  38. "group_by": {
  39. "customer_id": {
  40. "terms": {
  41. "field": "customer_id"
  42. }
  43. }
  44. },
  45. "aggregations": {
  46. "max_price": {
  47. "max": {
  48. "field": "taxful_total_price"
  49. }
  50. }
  51. }
  52. }
  53. }
  54. --------------------------------------------------
  55. // CONSOLE
  56. // TEST[skip:set up sample data]
  57. The data that is returned for this example is as follows:
  58. [source,js]
  59. ----
  60. {
  61. "preview" : [
  62. {
  63. "max_price" : 171.0,
  64. "customer_id" : "10"
  65. },
  66. {
  67. "max_price" : 233.0,
  68. "customer_id" : "11"
  69. },
  70. {
  71. "max_price" : 200.0,
  72. "customer_id" : "12"
  73. }
  74. ...
  75. ]
  76. }
  77. ----
  78. // NOTCONSOLE