put-transform.asciidoc 2.0 KB

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