put-transform.asciidoc 3.0 KB

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