preview-transform.asciidoc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. Previews a {dataframe-transform}.
  10. ==== Request
  11. `POST _data_frame/transforms/_preview`
  12. //==== Description
  13. //==== Path Parameters
  14. //==== Authorization
  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. ==== Examples
  20. The following example obtains a preview of a {dataframe-transform} on the {kib}
  21. eCommerce sample data:
  22. [source,js]
  23. --------------------------------------------------
  24. POST _data_frame/transforms/_preview
  25. {
  26. "source": "kibana_sample_data_ecommerce",
  27. "pivot": {
  28. "group_by": {
  29. "customer_id": {
  30. "terms": {
  31. "field": "customer_id"
  32. }
  33. }
  34. },
  35. "aggregations": {
  36. "max_price": {
  37. "max": {
  38. "field": "taxful_total_price"
  39. }
  40. }
  41. }
  42. }
  43. }
  44. --------------------------------------------------
  45. // CONSOLE
  46. // TEST[skip:set up sample data]
  47. The data that is returned for this example is as follows:
  48. [source,js]
  49. ----
  50. {
  51. "preview" : [
  52. {
  53. "max_price" : 171.0,
  54. "customer_id" : "10"
  55. },
  56. {
  57. "max_price" : 233.0,
  58. "customer_id" : "11"
  59. },
  60. {
  61. "max_price" : 200.0,
  62. "customer_id" : "12"
  63. }
  64. ...
  65. ]
  66. }
  67. ----
  68. // NOTCONSOLE