preview-transform.asciidoc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[preview-data-frame-transform]]
  4. === Preview {dataframe-transforms} API
  5. ++++
  6. <titleabbrev>Preview {dataframe-transforms}</titleabbrev>
  7. ++++
  8. Previews a {dataframe-transform}.
  9. ==== Request
  10. `POST _data_frame/transforms/_preview`
  11. //==== Description
  12. //==== Path Parameters
  13. //==== Authorization
  14. ==== Request Body
  15. `source`:: The source index or index pattern.
  16. `pivot`:: Defines the pivot function `group by` fields and the aggregation to
  17. reduce the data.
  18. ==== Examples
  19. The following example obtains a preview of a {dataframe-transform} on the {kib}
  20. eCommerce sample data:
  21. [source,js]
  22. --------------------------------------------------
  23. POST _data_frame/transforms/_preview
  24. {
  25. "source": "kibana_sample_data_ecommerce",
  26. "pivot": {
  27. "group_by": {
  28. "customer_id": {
  29. "terms": {
  30. "field": "customer_id"
  31. }
  32. }
  33. },
  34. "aggregations": {
  35. "max_price": {
  36. "max": {
  37. "field": "taxful_total_price"
  38. }
  39. }
  40. }
  41. }
  42. }
  43. --------------------------------------------------
  44. // CONSOLE
  45. // TEST[skip:set up sample data]
  46. The data that is returned for this example is as follows:
  47. [source,js]
  48. ----
  49. {
  50. "preview" : [
  51. {
  52. "max_price" : 171.0,
  53. "customer_id" : "10"
  54. },
  55. {
  56. "max_price" : 233.0,
  57. "customer_id" : "11"
  58. },
  59. {
  60. "max_price" : 200.0,
  61. "customer_id" : "12"
  62. }
  63. ...
  64. ]
  65. }
  66. ----
  67. // NOTCONSOLE