update-transform.asciidoc 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. [role="xpack"]
  2. [[update-transform]]
  3. = Update {transform} API
  4. [subs="attributes"]
  5. ++++
  6. <titleabbrev>Update {transform}</titleabbrev>
  7. ++++
  8. Updates certain properties of a {transform}.
  9. [[update-transform-request]]
  10. == {api-request-title}
  11. `POST _transform/<transform_id>/_update`
  12. [[update-transform-prereqs]]
  13. == {api-prereq-title}
  14. Requires the following privileges:
  15. * cluster: `manage_transform` (the `transform_admin` built-in role grants this
  16. privilege)
  17. * source indices: `read`, `view_index_metadata`
  18. * destination index: `read`, `index`. If a `retention_policy` is configured, `delete` index privilege is
  19. also required.
  20. [[update-transform-desc]]
  21. == {api-description-title}
  22. This API updates an existing {transform}. The list of properties that you can
  23. update is a subset of the list that you can define when you create a {transform}.
  24. When the {transform} is updated, a series of validations occur to ensure its
  25. success. You can use the `defer_validation` parameter to skip these checks.
  26. All updated properties except description do not take effect until after the
  27. {transform} starts the next checkpoint. This is so there is data consistency in
  28. each checkpoint.
  29. [IMPORTANT]
  30. ====
  31. * Your {transform} remembers which roles the user who updated it had at the time
  32. of update and runs with those privileges. If you provide
  33. <<http-clients-secondary-authorization,secondary authorization headers>>, those
  34. credentials are used instead.
  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::{es-repo-dir}/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. `timeout`::
  53. (Optional, time)
  54. Period to wait for a response. If no response is received before the timeout
  55. expires, the request fails and returns an error. Defaults to `30s`.
  56. [role="child_attributes"]
  57. [[update-transform-request-body]]
  58. == {api-request-body-title}
  59. `description`::
  60. (Optional, string) Free text description of the {transform}.
  61. //Begin dest
  62. `dest`::
  63. (Optional, object)
  64. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest]
  65. +
  66. .Properties of `dest`
  67. [%collapsible%open]
  68. ====
  69. `index`:::
  70. (Required, string)
  71. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest-index]
  72. `pipeline`:::
  73. (Optional, string)
  74. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest-pipeline]
  75. ====
  76. //End dest
  77. `frequency`::
  78. (Optional, <<time-units, time units>>)
  79. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=frequency]
  80. //Begin _meta
  81. `_meta`::
  82. (Optional, object)
  83. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-metadata]
  84. //End _meta
  85. //Begin retention policy
  86. `retention_policy`::
  87. (Optional, object)
  88. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention]
  89. +
  90. .Properties of `retention_policy`
  91. [%collapsible%open]
  92. ====
  93. `time`:::
  94. (Required, object)
  95. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention-time]
  96. +
  97. .Properties of `time`
  98. [%collapsible%open]
  99. =====
  100. `field`:::
  101. (Required, string)
  102. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention-time-field]
  103. `max_age`:::
  104. (Required, <<time-units, time units>>)
  105. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention-time-max-age]
  106. =====
  107. ====
  108. //End retention policy
  109. //Begin settings
  110. `settings`::
  111. (Optional, object)
  112. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings]
  113. +
  114. .Properties of `settings`
  115. [%collapsible%open]
  116. ====
  117. `dates_as_epoch_millis`:::
  118. (Optional, boolean)
  119. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-dates-as-epoch-milli]
  120. `docs_per_second`:::
  121. (Optional, float)
  122. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-docs-per-second]
  123. `align_checkpoints`:::
  124. (Optional, boolean)
  125. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-align-checkpoints]
  126. `deduce_mappings`:::
  127. (Optional, boolean)
  128. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-deduce-mappings]
  129. `max_page_search_size`:::
  130. (Optional, integer)
  131. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-max-page-search-size]
  132. ====
  133. //End settings
  134. //Begin source
  135. `source`::
  136. (Optional, object)
  137. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-transforms]
  138. +
  139. .Properties of `source`
  140. [%collapsible%open]
  141. ====
  142. `index`:::
  143. (Required, string or array)
  144. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-index-transforms]
  145. `query`:::
  146. (Optional, object)
  147. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-query-transforms]
  148. ====
  149. //End source
  150. //Begin sync
  151. `sync`::
  152. (Optional, object)
  153. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync]
  154. +
  155. --
  156. NOTE: You can update these properties only if it is a continuous {transform}. You
  157. cannot change a batch {transform} into a continuous {transform} or vice versa.
  158. Instead, clone the {transform} in {kib} and add or remove the `sync` property.
  159. --
  160. +
  161. .Properties of `sync`
  162. [%collapsible%open]
  163. ====
  164. //Begin sync.time
  165. `time`:::
  166. (Required, object)
  167. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time]
  168. +
  169. .Properties of `time`
  170. [%collapsible%open]
  171. =====
  172. `delay`::::
  173. (Optional, <<time-units, time units>>)
  174. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-delay]
  175. `field`::::
  176. (Required, string)
  177. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-field]
  178. +
  179. --
  180. TIP: In general, it’s a good idea to use a field that contains the
  181. <<access-ingest-metadata,ingest timestamp>>. If you use a different field,
  182. you might need to set the `delay` such that it accounts for data transmission
  183. delays.
  184. --
  185. =====
  186. //End sync.time
  187. ====
  188. //End sync
  189. [[update-transform-example]]
  190. == {api-examples-title}
  191. [source,console]
  192. --------------------------------------------------
  193. POST _transform/simple-kibana-ecomm-pivot/_update
  194. {
  195. "source": {
  196. "index": "kibana_sample_data_ecommerce",
  197. "query": {
  198. "term": {
  199. "geoip.continent_name": {
  200. "value": "Asia"
  201. }
  202. }
  203. }
  204. },
  205. "description": "Maximum priced ecommerce data by customer_id in Asia",
  206. "dest": {
  207. "index": "kibana_sample_data_ecommerce_transform_v2",
  208. "pipeline": "add_timestamp_pipeline"
  209. },
  210. "frequency": "15m",
  211. "sync": {
  212. "time": {
  213. "field": "order_date",
  214. "delay": "120s"
  215. }
  216. }
  217. }
  218. --------------------------------------------------
  219. // TEST[setup:simple_kibana_continuous_pivot]
  220. When the {transform} is updated, you receive the updated configuration:
  221. [source,console-result]
  222. ----
  223. {
  224. "id": "simple-kibana-ecomm-pivot",
  225. "source": {
  226. "index": ["kibana_sample_data_ecommerce"],
  227. "query": {
  228. "term": {
  229. "geoip.continent_name": {
  230. "value": "Asia"
  231. }
  232. }
  233. }
  234. },
  235. "pivot": {
  236. "group_by": {
  237. "customer_id": {
  238. "terms": {
  239. "field": "customer_id"
  240. }
  241. }
  242. },
  243. "aggregations": {
  244. "max_price": {
  245. "max": {
  246. "field": "taxful_total_price"
  247. }
  248. }
  249. }
  250. },
  251. "description": "Maximum priced ecommerce data by customer_id in Asia",
  252. "dest": {
  253. "index": "kibana_sample_data_ecommerce_transform_v2",
  254. "pipeline": "add_timestamp_pipeline"
  255. },
  256. "frequency": "15m",
  257. "sync": {
  258. "time": {
  259. "field": "order_date",
  260. "delay": "120s"
  261. }
  262. },
  263. "settings": { },
  264. "version": "7.5.0",
  265. "create_time": 1518808660505
  266. }
  267. ----
  268. // TESTRESPONSE[s/"version": "7.5.0"/"version": $body.version/]
  269. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]