put-transform.asciidoc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. beta[]
  11. [[put-data-frame-transform-request]]
  12. ==== {api-request-title}
  13. `PUT _data_frame/transforms/<data_frame_transform_id>`
  14. [[put-data-frame-transform-prereqs]]
  15. ==== {api-prereq-title}
  16. * If the {es} {security-features} are enabled, you must have
  17. `manage_data_frame_transforms` cluster privileges to use this API. The built-in
  18. `data_frame_transforms_admin` role has these privileges. You must also
  19. have `read` and `view_index_metadata` privileges on the source index and `read`,
  20. `create_index`, and `index` privileges on the destination index. For more
  21. information, see {stack-ov}/security-privileges.html[Security privileges] and
  22. {stack-ov}/built-in-roles.html[Built-in roles].
  23. [[put-data-frame-transform-desc]]
  24. ==== {api-description-title}
  25. IMPORTANT: You must use {kib} or this API to create a {dataframe-transform}.
  26. Do not put a {dataframe-transform} directly into any
  27. `.data-frame-internal*` indices using the Elasticsearch index API.
  28. If {es} {security-features} are enabled, do not give users any
  29. privileges on `.data-frame-internal*` indices.
  30. [[put-data-frame-transform-path-parms]]
  31. ==== {api-path-parms-title}
  32. `<data_frame_transform_id>`::
  33. (Required, string) Identifier for the {dataframe-transform}. This identifier
  34. can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and
  35. underscores. It must start and end with alphanumeric characters.
  36. [[put-data-frame-transform-request-body]]
  37. ==== {api-request-body-title}
  38. `description`::
  39. (Optional, string) Free text description of the {dataframe-transform}.
  40. `dest`::
  41. (Required, object) Required. The destination configuration, which consists of `index`
  42. and optionally a `pipeline` id. See <<data-frame-transform-dest>>.
  43. `frequency`::
  44. (Optional, time units) The interval between checks for changes in the source indices
  45. when the {dataframe-transform} is running continuously. Defaults to `1m`.
  46. The lowest permitted value is `1s`; the highest `1h`.
  47. `pivot`::
  48. (Required, object) Defines the pivot function `group by` fields and the aggregation to
  49. reduce the data. See <<data-frame-transform-pivot>>.
  50. `source`::
  51. (Required, object) The source configuration, which consists of `index` and
  52. optionally a `query`. See <<data-frame-transform-source>>.
  53. [[put-data-frame-transform-example]]
  54. ==== {api-examples-title}
  55. [source,js]
  56. --------------------------------------------------
  57. PUT _data_frame/transforms/ecommerce_transform
  58. {
  59. "source": {
  60. "index": "kibana_sample_data_ecommerce",
  61. "query": {
  62. "term": {
  63. "geoip.continent_name": {
  64. "value": "Asia"
  65. }
  66. }
  67. }
  68. },
  69. "dest": {
  70. "index": "kibana_sample_data_ecommerce_transform",
  71. "pipeline": "add_timestamp_pipeline"
  72. },
  73. "frequency": "5m",
  74. "pivot": {
  75. "group_by": {
  76. "customer_id": {
  77. "terms": {
  78. "field": "customer_id"
  79. }
  80. }
  81. },
  82. "aggregations": {
  83. "max_price": {
  84. "max": {
  85. "field": "taxful_total_price"
  86. }
  87. }
  88. }
  89. },
  90. "description": "Maximum priced ecommerce data by customer_id in Asia"
  91. }
  92. --------------------------------------------------
  93. // CONSOLE
  94. // TEST[setup:kibana_sample_data_ecommerce]
  95. When the transform is created, you receive the following results:
  96. [source,js]
  97. ----
  98. {
  99. "acknowledged" : true
  100. }
  101. ----
  102. // TESTRESPONSE