update-transform.asciidoc 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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. * When {es} {security-features} are enabled, your {transform} remembers which
  32. roles the user who updated it had at the time of update and runs with those
  33. privileges.
  34. * You must use {kib} or this API to update a {transform}. Do not update a
  35. {transform} directly via `.transform-internal*` indices using the {es} index API.
  36. If {es} {security-features} are enabled, do not give users any privileges on
  37. `.transform-internal*` indices. If you used {transforms} prior 7.5, also do not
  38. give users any privileges on `.data-frame-internal*` indices.
  39. ====
  40. [[update-transform-path-parms]]
  41. == {api-path-parms-title}
  42. `<transform_id>`::
  43. (Required, string)
  44. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-id]
  45. [[update-transform-query-parms]]
  46. == {api-query-parms-title}
  47. `defer_validation`::
  48. (Optional, Boolean) When `true`, deferrable validations are not run. This
  49. behavior may be desired if the source index does not exist until after the
  50. {transform} is updated.
  51. `timeout`::
  52. (Optional, time)
  53. Period to wait for a response. If no response is received before the timeout
  54. expires, the request fails and returns an error. Defaults to `30s`.
  55. [role="child_attributes"]
  56. [[update-transform-request-body]]
  57. == {api-request-body-title}
  58. `description`::
  59. (Optional, string) Free text description of the {transform}.
  60. //Begin dest
  61. `dest`::
  62. (Optional, object)
  63. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest]
  64. +
  65. .Properties of `dest`
  66. [%collapsible%open]
  67. ====
  68. `index`:::
  69. (Required, string)
  70. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest-index]
  71. `pipeline`:::
  72. (Optional, string)
  73. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest-pipeline]
  74. ====
  75. //End dest
  76. `frequency`::
  77. (Optional, <<time-units, time units>>)
  78. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=frequency]
  79. //Begin _meta
  80. `_meta`::
  81. (Optional, object)
  82. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-metadata]
  83. //End _meta
  84. //Begin retention policy
  85. `retention_policy`::
  86. (Optional, object)
  87. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention]
  88. +
  89. .Properties of `retention_policy`
  90. [%collapsible%open]
  91. ====
  92. `time`:::
  93. (Required, object)
  94. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention-time]
  95. +
  96. .Properties of `time`
  97. [%collapsible%open]
  98. =====
  99. `field`:::
  100. (Required, string)
  101. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention-time-field]
  102. `max_age`:::
  103. (Required, <<time-units, time units>>)
  104. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention-time-max-age]
  105. =====
  106. ====
  107. //End retention policy
  108. //Begin settings
  109. `settings`::
  110. (Optional, object)
  111. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings]
  112. +
  113. .Properties of `settings`
  114. [%collapsible%open]
  115. ====
  116. `dates_as_epoch_millis`:::
  117. (Optional, boolean)
  118. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-dates-as-epoch-milli]
  119. `docs_per_second`:::
  120. (Optional, float)
  121. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-docs-per-second]
  122. `align_checkpoints`:::
  123. (Optional, boolean)
  124. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-align-checkpoints]
  125. `deduce_mappings`:::
  126. (Optional, boolean)
  127. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-deduce-mappings]
  128. `max_page_search_size`:::
  129. (Optional, integer)
  130. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-max-page-search-size]
  131. ====
  132. //End settings
  133. //Begin source
  134. `source`::
  135. (Optional, object)
  136. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-transforms]
  137. +
  138. .Properties of `source`
  139. [%collapsible%open]
  140. ====
  141. `index`:::
  142. (Required, string or array)
  143. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-index-transforms]
  144. `query`:::
  145. (Optional, object)
  146. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-query-transforms]
  147. ====
  148. //End source
  149. //Begin sync
  150. `sync`::
  151. (Optional, object)
  152. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync]
  153. +
  154. --
  155. NOTE: You can update these properties only if it is a continuous {transform}. You
  156. cannot change a batch {transform} into a continuous {transform} or vice versa.
  157. Instead, clone the {transform} in {kib} and add or remove the `sync` property.
  158. --
  159. +
  160. .Properties of `sync`
  161. [%collapsible%open]
  162. ====
  163. //Begin sync.time
  164. `time`:::
  165. (Required, object)
  166. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time]
  167. +
  168. .Properties of `time`
  169. [%collapsible%open]
  170. =====
  171. `delay`::::
  172. (Optional, <<time-units, time units>>)
  173. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-delay]
  174. `field`::::
  175. (Required, string)
  176. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-field]
  177. +
  178. --
  179. TIP: In general, it’s a good idea to use a field that contains the
  180. <<access-ingest-metadata,ingest timestamp>>. If you use a different field,
  181. you might need to set the `delay` such that it accounts for data transmission
  182. delays.
  183. --
  184. =====
  185. //End sync.time
  186. ====
  187. //End sync
  188. [[update-transform-example]]
  189. == {api-examples-title}
  190. [source,console]
  191. --------------------------------------------------
  192. POST _transform/simple-kibana-ecomm-pivot/_update
  193. {
  194. "source": {
  195. "index": "kibana_sample_data_ecommerce",
  196. "query": {
  197. "term": {
  198. "geoip.continent_name": {
  199. "value": "Asia"
  200. }
  201. }
  202. }
  203. },
  204. "description": "Maximum priced ecommerce data by customer_id in Asia",
  205. "dest": {
  206. "index": "kibana_sample_data_ecommerce_transform_v2",
  207. "pipeline": "add_timestamp_pipeline"
  208. },
  209. "frequency": "15m",
  210. "sync": {
  211. "time": {
  212. "field": "order_date",
  213. "delay": "120s"
  214. }
  215. }
  216. }
  217. --------------------------------------------------
  218. // TEST[setup:simple_kibana_continuous_pivot]
  219. When the {transform} is updated, you receive the updated configuration:
  220. [source,console-result]
  221. ----
  222. {
  223. "id": "simple-kibana-ecomm-pivot",
  224. "source": {
  225. "index": ["kibana_sample_data_ecommerce"],
  226. "query": {
  227. "term": {
  228. "geoip.continent_name": {
  229. "value": "Asia"
  230. }
  231. }
  232. }
  233. },
  234. "pivot": {
  235. "group_by": {
  236. "customer_id": {
  237. "terms": {
  238. "field": "customer_id"
  239. }
  240. }
  241. },
  242. "aggregations": {
  243. "max_price": {
  244. "max": {
  245. "field": "taxful_total_price"
  246. }
  247. }
  248. }
  249. },
  250. "description": "Maximum priced ecommerce data by customer_id in Asia",
  251. "dest": {
  252. "index": "kibana_sample_data_ecommerce_transform_v2",
  253. "pipeline": "add_timestamp_pipeline"
  254. },
  255. "frequency": "15m",
  256. "sync": {
  257. "time": {
  258. "field": "order_date",
  259. "delay": "120s"
  260. }
  261. },
  262. "settings": { },
  263. "version": "7.5.0",
  264. "create_time": 1518808660505
  265. }
  266. ----
  267. // TESTRESPONSE[s/"version": "7.5.0"/"version": $body.version/]
  268. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]