update-transform.asciidoc 7.8 KB

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