update-transform.asciidoc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[update-transform]]
  4. === Update {transform} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Update {transform}</titleabbrev>
  8. ++++
  9. Updates certain properties of a {transform}.
  10. [[update-transform-request]]
  11. ==== {api-request-title}
  12. `POST _transform/<transform_id>/_update`
  13. [[update-transform-prereqs]]
  14. ==== {api-prereq-title}
  15. * If the {es} {security-features} are enabled, you must have `manage_transform`
  16. cluster privileges to use this API. The built-in `transform_admin` role has
  17. these privileges. You must also have `read` and `view_index_metadata`
  18. privileges on the source index and `read`, `create_index`, and `index`
  19. privileges on the destination index. For more information, see
  20. <<security-privileges>> and <<built-in-roles>>.
  21. [[update-transform-desc]]
  22. ==== {api-description-title}
  23. This API updates an existing {transform}. The list of properties that you can
  24. update is a subset of the list that you can define when you create a {transform}.
  25. When the {transform} is updated, a series of validations occur to ensure its
  26. success. You can use the `defer_validation` parameter to skip these checks.
  27. All updated properties except description do not take effect until after the
  28. {transform} starts the next checkpoint. This is so there is consistency with the
  29. pivoted data in each checkpoint.
  30. [IMPORTANT]
  31. ====
  32. * When {es} {security-features} are enabled, your {transform} remembers which
  33. roles the user who updated it had at the time of update and runs with those
  34. privileges.
  35. * You must use {kib} or this API to update a {transform}. Do not update a
  36. {transform} directly via `.transform-internal*` indices using the {es} index API.
  37. If {es} {security-features} are enabled, do not give users any privileges on
  38. `.transform-internal*` indices. If you used {transforms} prior 7.5, also do not
  39. give users any privileges on `.data-frame-internal*` indices.
  40. ====
  41. [[update-transform-path-parms]]
  42. ==== {api-path-parms-title}
  43. `<transform_id>`::
  44. (Required, string)
  45. include::{docdir}/rest-api/common-parms.asciidoc[tag=transform-id]
  46. [[update-transform-query-parms]]
  47. ==== {api-query-parms-title}
  48. `defer_validation`::
  49. (Optional, boolean) When `true`, deferrable validations are not run. This
  50. behavior may be desired if the source index does not exist until after the
  51. {transform} is updated.
  52. [role="child_attributes"]
  53. [[update-transform-request-body]]
  54. ==== {api-request-body-title}
  55. `description`::
  56. (Optional, string) Free text description of the {transform}.
  57. //Begin dest
  58. `dest`::
  59. (Optional, object)
  60. include::{docdir}/rest-api/common-parms.asciidoc[tag=dest]
  61. +
  62. .Properties of `dest`
  63. [%collapsible%open]
  64. ====
  65. `index`:::
  66. (Required, string)
  67. include::{docdir}/rest-api/common-parms.asciidoc[tag=dest-index]
  68. `pipeline`:::
  69. (Optional, string)
  70. include::{docdir}/rest-api/common-parms.asciidoc[tag=dest-pipeline]
  71. ====
  72. //End dest
  73. `frequency`::
  74. (Optional, <<time-units, time units>>)
  75. include::{docdir}/rest-api/common-parms.asciidoc[tag=frequency]
  76. //Begin source
  77. `source`::
  78. (Optional, object)
  79. include::{docdir}/rest-api/common-parms.asciidoc[tag=source-transforms]
  80. +
  81. .Properties of `source`
  82. [%collapsible%open]
  83. ====
  84. `index`:::
  85. (Required, string or array)
  86. include::{docdir}/rest-api/common-parms.asciidoc[tag=source-index-transforms]
  87. `query`:::
  88. (Optional, object)
  89. include::{docdir}/rest-api/common-parms.asciidoc[tag=source-query-transforms]
  90. ====
  91. //End source
  92. //Begin sync
  93. `sync`::
  94. (Optional, object)
  95. include::{docdir}/rest-api/common-parms.asciidoc[tag=sync]
  96. +
  97. .Properties of `sync`
  98. [%collapsible%open]
  99. ====
  100. //Begin sync.time
  101. `time`:::
  102. (Required, object)
  103. include::{docdir}/rest-api/common-parms.asciidoc[tag=sync-time]
  104. +
  105. .Properties of `time`
  106. [%collapsible%open]
  107. =====
  108. `delay`::::
  109. (Optional, <<time-units, time units>>)
  110. include::{docdir}/rest-api/common-parms.asciidoc[tag=sync-time-delay]
  111. `field`::::
  112. (Required, string)
  113. include::{docdir}/rest-api/common-parms.asciidoc[tag=sync-time-field]
  114. +
  115. --
  116. TIP: In general, it’s a good idea to use a field that contains the
  117. <<accessing-ingest-metadata,ingest timestamp>>. If you use a different field,
  118. you might need to set the `delay` such that it accounts for data transmission
  119. delays.
  120. --
  121. =====
  122. //End sync.time
  123. ====
  124. //End sync
  125. [[update-transform-example]]
  126. ==== {api-examples-title}
  127. [source,console]
  128. --------------------------------------------------
  129. POST _transform/simple-kibana-ecomm-pivot/_update
  130. {
  131. "source": {
  132. "index": "kibana_sample_data_ecommerce",
  133. "query": {
  134. "term": {
  135. "geoip.continent_name": {
  136. "value": "Asia"
  137. }
  138. }
  139. }
  140. },
  141. "description": "Maximum priced ecommerce data by customer_id in Asia",
  142. "dest": {
  143. "index": "kibana_sample_data_ecommerce_transform_v2",
  144. "pipeline": "add_timestamp_pipeline"
  145. },
  146. "frequency": "15m",
  147. "sync": {
  148. "time": {
  149. "field": "order_date",
  150. "delay": "120s"
  151. }
  152. }
  153. }
  154. --------------------------------------------------
  155. // TEST[setup:simple_kibana_continuous_pivot]
  156. When the {transform} is updated, you receive the updated configuration:
  157. [source,console-result]
  158. ----
  159. {
  160. "id": "simple-kibana-ecomm-pivot",
  161. "source": {
  162. "index": ["kibana_sample_data_ecommerce"],
  163. "query": {
  164. "term": {
  165. "geoip.continent_name": {
  166. "value": "Asia"
  167. }
  168. }
  169. }
  170. },
  171. "pivot": {
  172. "group_by": {
  173. "customer_id": {
  174. "terms": {
  175. "field": "customer_id"
  176. }
  177. }
  178. },
  179. "aggregations": {
  180. "max_price": {
  181. "max": {
  182. "field": "taxful_total_price"
  183. }
  184. }
  185. }
  186. },
  187. "description": "Maximum priced ecommerce data by customer_id in Asia",
  188. "dest": {
  189. "index": "kibana_sample_data_ecommerce_transform_v2",
  190. "pipeline": "add_timestamp_pipeline"
  191. },
  192. "frequency": "15m",
  193. "sync": {
  194. "time": {
  195. "field": "order_date",
  196. "delay": "120s"
  197. }
  198. },
  199. "version": "7.5.0",
  200. "create_time": 1518808660505
  201. }
  202. ----
  203. // TESTRESPONSE[s/"version": "7.5.0"/"version": $body.version/]
  204. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]