1
0

put-transform.asciidoc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. IMPORTANT: You must use {kib} or this API to create a {dataframe-transform}.
  14. Do not put a {dataframe-transform} directly into any
  15. `.data-frame-internal*` indices using the Elasticsearch index API.
  16. If {es} {security-features} are enabled, do not give users any
  17. privileges on `.data-frame-internal*` indices.
  18. ==== Path Parameters
  19. `data_frame_transform_id` (required)::
  20. (string) Identifier for the {dataframe-transform}. This identifier can contain
  21. lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It
  22. must start and end with alphanumeric characters.
  23. ==== Request Body
  24. `source` (required):: (object) The source configuration, consisting of `index` and optionally
  25. a `query`.
  26. `dest` (required):: (object) The destination configuration, consisting of `index`.
  27. `pivot`:: (object) Defines the pivot function `group by` fields and the aggregation to
  28. reduce the data. See <<data-frame-transform-pivot, data frame transform pivot objects>>.
  29. `description`:: Optional free text description of the data frame transform
  30. //==== Authorization
  31. ==== Examples
  32. The following example creates a {dataframe-transform} for the {kib} eCommerce
  33. sample data:
  34. [source,js]
  35. --------------------------------------------------
  36. PUT _data_frame/transforms/ecommerce_transform
  37. {
  38. "source": {
  39. "index": "kibana_sample_data_ecommerce",
  40. "query": {
  41. "term": {
  42. "geoip.continent_name": {
  43. "value": "Asia"
  44. }
  45. }
  46. }
  47. },
  48. "dest": {
  49. "index": "kibana_sample_data_ecommerce_transform"
  50. },
  51. "pivot": {
  52. "group_by": {
  53. "customer_id": {
  54. "terms": {
  55. "field": "customer_id"
  56. }
  57. }
  58. },
  59. "aggregations": {
  60. "max_price": {
  61. "max": {
  62. "field": "taxful_total_price"
  63. }
  64. }
  65. }
  66. },
  67. "description": "Maximum priced ecommerce data by customer_id in Asia"
  68. }
  69. --------------------------------------------------
  70. // CONSOLE
  71. // TEST[skip:add sample kibana data]
  72. When the transform is created, you receive the following results:
  73. [source,js]
  74. ----
  75. {
  76. "acknowledged" : true
  77. }
  78. ----
  79. // NOTCONSOLE