preview-transform.asciidoc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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": {
  27. "index": "kibana_sample_data_ecommerce"
  28. },
  29. "pivot": {
  30. "group_by": {
  31. "customer_id": {
  32. "terms": {
  33. "field": "customer_id"
  34. }
  35. }
  36. },
  37. "aggregations": {
  38. "max_price": {
  39. "max": {
  40. "field": "taxful_total_price"
  41. }
  42. }
  43. }
  44. }
  45. }
  46. --------------------------------------------------
  47. // CONSOLE
  48. // TEST[skip:set up sample data]
  49. The data that is returned for this example is as follows:
  50. [source,js]
  51. ----
  52. {
  53. "preview" : [
  54. {
  55. "max_price" : 171.0,
  56. "customer_id" : "10"
  57. },
  58. {
  59. "max_price" : 233.0,
  60. "customer_id" : "11"
  61. },
  62. {
  63. "max_price" : 200.0,
  64. "customer_id" : "12"
  65. }
  66. ...
  67. ]
  68. }
  69. ----
  70. // NOTCONSOLE