update-transform.asciidoc 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[update-data-frame-transform]]
  4. === Update {transforms} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Update {transforms}</titleabbrev>
  8. ++++
  9. Updates an existing {transform}.
  10. beta[]
  11. [[update-data-frame-transform-request]]
  12. ==== {api-request-title}
  13. `POST _data_frame/transforms/<data_frame_transform_id>/_update`
  14. [[update-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. [[update-data-frame-transform-desc]]
  24. ==== {api-description-title}
  25. This API updates an existing {transform}. All settings except description do not
  26. take effect until after the {transform} starts the next checkpoint. This is
  27. so there is consistency with the pivoted data in each checkpoint.
  28. IMPORTANT: When {es} {security-features} are enabled, your {transform}
  29. remembers which roles the user who updated it had at the time of update and
  30. runs with those privileges.
  31. IMPORTANT: You must use {kib} or this API to update a {transform}.
  32. Do not update a {transform} directly via
  33. `.data-frame-internal*` indices using the Elasticsearch index API.
  34. If {es} {security-features} are enabled, do not give users any
  35. privileges on `.data-frame-internal*` indices.
  36. [[update-data-frame-transform-path-parms]]
  37. ==== {api-path-parms-title}
  38. `<data_frame_transform_id>`::
  39. (Required, string) Identifier for the {transform}. This identifier
  40. can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and
  41. underscores. It must start and end with alphanumeric characters.
  42. [[update-data-frame-transform-query-parms]]
  43. ==== {api-query-parms-title}
  44. `defer_validation`::
  45. (Optional, boolean) When `true`, deferrable validations are not run. This
  46. behavior may be desired if the source index does not exist until after the
  47. {transform} is updated.
  48. [[update-data-frame-transform-request-body]]
  49. ==== {api-request-body-title}
  50. `description`::
  51. (Optional, string) Free text description of the {transform}.
  52. `dest`::
  53. (Optional, object) The destination configuration, which has the
  54. following properties:
  55. `index`:::
  56. (Required, string) The _destination index_ for the {transform}.
  57. `pipeline`:::
  58. (Optional, string) The unique identifier for a <<pipeline,pipeline>>.
  59. `frequency`::
  60. (Optional, <<time-units, time units>>) The interval between checks for changes
  61. in the source indices when the {transform} is running continuously.
  62. Also determines the retry interval in the event of transient failures while
  63. the {transform} is searching or indexing. The minimum value is `1s`
  64. and the maximum is `1h`. The default value is `1m`.
  65. `source`::
  66. (Optional, object) The source configuration, which has the following
  67. properties:
  68. `index`:::
  69. (Required, string or array) The _source indices_ for the
  70. {transform}. It can be a single index, an index pattern (for
  71. example, `"myindex*"`), or an array of indices (for example,
  72. `["index1", "index2"]`).
  73. `query`:::
  74. (Optional, object) A query clause that retrieves a subset of data from the
  75. source index. See <<query-dsl>>.
  76. `sync`::
  77. (Optional, object) Defines the properties required to run continuously.
  78. `time`:::
  79. (Required, object) Specifies that the {transform} uses a time
  80. field to synchronize the source and destination indices.
  81. `field`::::
  82. (Required, string) The date field that is used to identify new documents
  83. in the source.
  84. +
  85. --
  86. TIP: In general, it’s a good idea to use a field that contains the
  87. <<accessing-ingest-metadata,ingest timestamp>>. If you use a different field,
  88. you might need to set the `delay` such that it accounts for data transmission
  89. delays.
  90. --
  91. `delay`::::
  92. (Optional, <<time-units, time units>>) The time delay between the current
  93. time and the latest input data time. The default value is `60s`.
  94. [[update-data-frame-transform-example]]
  95. ==== {api-examples-title}
  96. [source,console]
  97. --------------------------------------------------
  98. POST _data_frame/transforms/simple-kibana-ecomm-pivot/_update
  99. {
  100. "source": {
  101. "index": "kibana_sample_data_ecommerce",
  102. "query": {
  103. "term": {
  104. "geoip.continent_name": {
  105. "value": "Asia"
  106. }
  107. }
  108. }
  109. },
  110. "description": "Maximum priced ecommerce data by customer_id in Asia",
  111. "dest": {
  112. "index": "kibana_sample_data_ecommerce_transform_v2",
  113. "pipeline": "add_timestamp_pipeline"
  114. },
  115. "frequency": "15m",
  116. "sync": {
  117. "time": {
  118. "field": "order_date",
  119. "delay": "120s"
  120. }
  121. }
  122. }
  123. --------------------------------------------------
  124. // TEST[setup:simple_kibana_continuous_pivot]
  125. When the {transform} is updated, you receive the updated configuration:
  126. [source,console-result]
  127. ----
  128. {
  129. "id": "simple-kibana-ecomm-pivot",
  130. "source": {
  131. "index": ["kibana_sample_data_ecommerce"],
  132. "query": {
  133. "term": {
  134. "geoip.continent_name": {
  135. "value": "Asia"
  136. }
  137. }
  138. }
  139. },
  140. "pivot": {
  141. "group_by": {
  142. "customer_id": {
  143. "terms": {
  144. "field": "customer_id"
  145. }
  146. }
  147. },
  148. "aggregations": {
  149. "max_price": {
  150. "max": {
  151. "field": "taxful_total_price"
  152. }
  153. }
  154. }
  155. },
  156. "description": "Maximum priced ecommerce data by customer_id in Asia",
  157. "dest": {
  158. "index": "kibana_sample_data_ecommerce_transform_v2",
  159. "pipeline": "add_timestamp_pipeline"
  160. },
  161. "frequency": "15m",
  162. "sync": {
  163. "time": {
  164. "field": "order_date",
  165. "delay": "120s"
  166. }
  167. },
  168. "version": "8.0.0-alpha1",
  169. "create_time": 1518808660505
  170. }
  171. ----
  172. // TESTRESPONSE[s/"version": "8.0.0-alpha1"/"version": $body.version/]
  173. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]