1
0

update-transform.asciidoc 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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. `dates_as_epoch_millis`:::
  116. (Optional, boolean)
  117. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-dates-as-epoch-milli]
  118. `docs_per_second`:::
  119. (Optional, float)
  120. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-docs-per-second]
  121. `align_checkpoints`:::
  122. (Optional, boolean)
  123. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-align-checkpoints]
  124. `deduce_mappings`:::
  125. (Optional, boolean)
  126. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-deduce-mappings]
  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. ====
  134. //End settings
  135. //Begin source
  136. `source`::
  137. (Optional, object)
  138. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-transforms]
  139. +
  140. .Properties of `source`
  141. [%collapsible%open]
  142. ====
  143. `index`:::
  144. (Required, string or array)
  145. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-index-transforms]
  146. `query`:::
  147. (Optional, object)
  148. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-query-transforms]
  149. ====
  150. //End source
  151. //Begin sync
  152. `sync`::
  153. (Optional, object)
  154. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync]
  155. +
  156. --
  157. NOTE: You can update these properties only if it is a continuous {transform}. You
  158. cannot change a batch {transform} into a continuous {transform} or vice versa.
  159. Instead, clone the {transform} in {kib} and add or remove the `sync` property.
  160. --
  161. +
  162. .Properties of `sync`
  163. [%collapsible%open]
  164. ====
  165. //Begin sync.time
  166. `time`:::
  167. (Required, object)
  168. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time]
  169. +
  170. .Properties of `time`
  171. [%collapsible%open]
  172. =====
  173. `delay`::::
  174. (Optional, <<time-units, time units>>)
  175. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-delay]
  176. `field`::::
  177. (Required, string)
  178. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-field]
  179. +
  180. --
  181. TIP: In general, it’s a good idea to use a field that contains the
  182. <<access-ingest-metadata,ingest timestamp>>. If you use a different field,
  183. you might need to set the `delay` such that it accounts for data transmission
  184. delays.
  185. --
  186. =====
  187. //End sync.time
  188. ====
  189. //End sync
  190. [[update-transform-example]]
  191. == {api-examples-title}
  192. [source,console]
  193. --------------------------------------------------
  194. POST _transform/simple-kibana-ecomm-pivot/_update
  195. {
  196. "source": {
  197. "index": "kibana_sample_data_ecommerce",
  198. "query": {
  199. "term": {
  200. "geoip.continent_name": {
  201. "value": "Asia"
  202. }
  203. }
  204. }
  205. },
  206. "description": "Maximum priced ecommerce data by customer_id in Asia",
  207. "dest": {
  208. "index": "kibana_sample_data_ecommerce_transform_v2",
  209. "pipeline": "add_timestamp_pipeline"
  210. },
  211. "frequency": "15m",
  212. "sync": {
  213. "time": {
  214. "field": "order_date",
  215. "delay": "120s"
  216. }
  217. }
  218. }
  219. --------------------------------------------------
  220. // TEST[setup:simple_kibana_continuous_pivot]
  221. When the {transform} is updated, you receive the updated configuration:
  222. [source,console-result]
  223. ----
  224. {
  225. "id" : "simple-kibana-ecomm-pivot",
  226. "authorization" : {
  227. "roles" : [
  228. "superuser"
  229. ]
  230. },
  231. "version" : "8.4.0",
  232. "create_time" : 1656113450613,
  233. "source" : {
  234. "index" : [
  235. "kibana_sample_data_ecommerce"
  236. ],
  237. "query" : {
  238. "term" : {
  239. "geoip.continent_name" : {
  240. "value" : "Asia"
  241. }
  242. }
  243. }
  244. },
  245. "dest" : {
  246. "index" : "kibana_sample_data_ecommerce_transform_v2",
  247. "pipeline" : "add_timestamp_pipeline"
  248. },
  249. "frequency" : "15m",
  250. "sync" : {
  251. "time" : {
  252. "field" : "order_date",
  253. "delay" : "120s"
  254. }
  255. },
  256. "pivot" : {
  257. "group_by" : {
  258. "customer_id" : {
  259. "terms" : {
  260. "field" : "customer_id"
  261. }
  262. }
  263. },
  264. "aggregations" : {
  265. "max_price" : {
  266. "max" : {
  267. "field" : "taxful_total_price"
  268. }
  269. }
  270. }
  271. },
  272. "description" : "Maximum priced ecommerce data by customer_id in Asia",
  273. "settings" : { }
  274. }
  275. ----
  276. // TESTRESPONSE[s/"version" : "8.4.0"/"version" : $body.version/]
  277. // TESTRESPONSE[s/"create_time" : 1656113450613/"create_time" : $body.create_time/]
  278. // TESTRESPONSE[s/"authorization" : \{[^}]*\},//]