put-transform.asciidoc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[put-data-frame-transform]]
  4. === Create {dataframe-transforms} API
  5. ++++
  6. <titleabbrev>Create {dataframe-transforms}</titleabbrev>
  7. ++++
  8. Instantiates a {dataframe-transform}.
  9. ==== Request
  10. `PUT _data_frame/transforms/<data_frame_transform_id>`
  11. //===== Description
  12. ==== Path Parameters
  13. `data_frame_transform_id` (required)::
  14. (string) Identifier for the {dataframe-transform}. This identifier can contain
  15. lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It
  16. must start and end with alphanumeric characters.
  17. ==== Request Body
  18. `source`:: (object) The source configuration, consisting of `index` and optionally
  19. a `query`.
  20. `dest`:: (object) The destination configuration, consisting of `index`.
  21. `pivot`:: Defines the pivot function `group by` fields and the aggregation to
  22. reduce the data.
  23. `description`:: Optional free text description of the data frame transform
  24. //==== Authorization
  25. ==== Examples
  26. The following example creates a {dataframe-transform} for the {kib} eCommerce
  27. sample data:
  28. [source,js]
  29. --------------------------------------------------
  30. PUT _data_frame/transforms/ecommerce_transform
  31. {
  32. "source": {
  33. "index": "kibana_sample_data_ecommerce",
  34. "query": {
  35. "term": {
  36. "geoip.continent_name": {
  37. "value": "Asia"
  38. }
  39. }
  40. }
  41. },
  42. "dest": {
  43. "index": "kibana_sample_data_ecommerce_transform"
  44. },
  45. "pivot": {
  46. "group_by": {
  47. "customer_id": {
  48. "terms": {
  49. "field": "customer_id"
  50. }
  51. }
  52. },
  53. "aggregations": {
  54. "max_price": {
  55. "max": {
  56. "field": "taxful_total_price"
  57. }
  58. }
  59. }
  60. },
  61. "description": "Maximum priced ecommerce data by customer_id in Asia"
  62. }
  63. --------------------------------------------------
  64. // CONSOLE
  65. // TEST[skip:add sample kibana data]
  66. When the transform is created, you receive the following results:
  67. [source,js]
  68. ----
  69. {
  70. "acknowledged" : true
  71. }
  72. ----
  73. // NOTCONSOLE