update-transform.asciidoc 8.2 KB

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