update-transform.asciidoc 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[update-transform]]
  4. = Update {transform} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Update {transform}</titleabbrev>
  8. ++++
  9. Updates certain properties of a {transform}.
  10. [[update-transform-request]]
  11. == {api-request-title}
  12. `POST _transform/<transform_id>/_update`
  13. [[update-transform-prereqs]]
  14. == {api-prereq-title}
  15. Requires the following privileges:
  16. * cluster: `manage_transform` (the `transform_admin` built-in role grants this
  17. privilege)
  18. * source indices: `read`, `view_index_metadata`
  19. * destination index: `read`, `index`.
  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. [role="child_attributes"]
  52. [[update-transform-request-body]]
  53. == {api-request-body-title}
  54. `description`::
  55. (Optional, string) Free text description of the {transform}.
  56. //Begin dest
  57. `dest`::
  58. (Optional, object)
  59. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest]
  60. +
  61. .Properties of `dest`
  62. [%collapsible%open]
  63. ====
  64. `index`:::
  65. (Required, string)
  66. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest-index]
  67. `pipeline`:::
  68. (Optional, string)
  69. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=dest-pipeline]
  70. ====
  71. //End dest
  72. `frequency`::
  73. (Optional, <<time-units, time units>>)
  74. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=frequency]
  75. //Begin retention policy
  76. `retention_policy`::
  77. (Optional, object)
  78. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention]
  79. +
  80. .Properties of `retention_policy`
  81. [%collapsible%open]
  82. ====
  83. `time`:::
  84. (Required, object)
  85. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention-time]
  86. +
  87. .Properties of `time`
  88. [%collapsible%open]
  89. =====
  90. `field`:::
  91. (Required, string)
  92. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention-time-field]
  93. `max_age`:::
  94. (Required, <<time-units, time units>>)
  95. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-retention-time-max-age]
  96. =====
  97. ====
  98. //End retention policy
  99. //Begin settings
  100. `settings`::
  101. (Optional, object)
  102. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings]
  103. +
  104. .Properties of `settings`
  105. [%collapsible%open]
  106. ====
  107. `dates_as_epoch_millis`:::
  108. (Optional, boolean)
  109. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-dates-as-epoch-milli]
  110. `docs_per_second`:::
  111. (Optional, float)
  112. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-docs-per-second]
  113. `align_checkpoints`:::
  114. (Optional, boolean)
  115. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-align-checkpoints]
  116. `max_page_search_size`:::
  117. (Optional, integer)
  118. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=transform-settings-max-page-search-size]
  119. ====
  120. //End settings
  121. //Begin source
  122. `source`::
  123. (Optional, object)
  124. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-transforms]
  125. +
  126. .Properties of `source`
  127. [%collapsible%open]
  128. ====
  129. `index`:::
  130. (Required, string or array)
  131. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-index-transforms]
  132. `query`:::
  133. (Optional, object)
  134. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source-query-transforms]
  135. ====
  136. //End source
  137. //Begin sync
  138. `sync`::
  139. (Optional, object)
  140. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync]
  141. +
  142. --
  143. NOTE: You can update these properties only if it is a continuous {transform}. You
  144. cannot change a batch {transform} into a continuous {transform} or vice versa.
  145. Instead, clone the {transform} in {kib} and add or remove the `sync` property.
  146. --
  147. +
  148. .Properties of `sync`
  149. [%collapsible%open]
  150. ====
  151. //Begin sync.time
  152. `time`:::
  153. (Required, object)
  154. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time]
  155. +
  156. .Properties of `time`
  157. [%collapsible%open]
  158. =====
  159. `delay`::::
  160. (Optional, <<time-units, time units>>)
  161. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-delay]
  162. `field`::::
  163. (Required, string)
  164. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=sync-time-field]
  165. +
  166. --
  167. TIP: In general, it’s a good idea to use a field that contains the
  168. <<access-ingest-metadata,ingest timestamp>>. If you use a different field,
  169. you might need to set the `delay` such that it accounts for data transmission
  170. delays.
  171. --
  172. =====
  173. //End sync.time
  174. ====
  175. //End sync
  176. [[update-transform-example]]
  177. == {api-examples-title}
  178. [source,console]
  179. --------------------------------------------------
  180. POST _transform/simple-kibana-ecomm-pivot/_update
  181. {
  182. "source": {
  183. "index": "kibana_sample_data_ecommerce",
  184. "query": {
  185. "term": {
  186. "geoip.continent_name": {
  187. "value": "Asia"
  188. }
  189. }
  190. }
  191. },
  192. "description": "Maximum priced ecommerce data by customer_id in Asia",
  193. "dest": {
  194. "index": "kibana_sample_data_ecommerce_transform_v2",
  195. "pipeline": "add_timestamp_pipeline"
  196. },
  197. "frequency": "15m",
  198. "sync": {
  199. "time": {
  200. "field": "order_date",
  201. "delay": "120s"
  202. }
  203. }
  204. }
  205. --------------------------------------------------
  206. // TEST[setup:simple_kibana_continuous_pivot]
  207. When the {transform} is updated, you receive the updated configuration:
  208. [source,console-result]
  209. ----
  210. {
  211. "id": "simple-kibana-ecomm-pivot",
  212. "source": {
  213. "index": ["kibana_sample_data_ecommerce"],
  214. "query": {
  215. "term": {
  216. "geoip.continent_name": {
  217. "value": "Asia"
  218. }
  219. }
  220. }
  221. },
  222. "pivot": {
  223. "group_by": {
  224. "customer_id": {
  225. "terms": {
  226. "field": "customer_id"
  227. }
  228. }
  229. },
  230. "aggregations": {
  231. "max_price": {
  232. "max": {
  233. "field": "taxful_total_price"
  234. }
  235. }
  236. }
  237. },
  238. "description": "Maximum priced ecommerce data by customer_id in Asia",
  239. "dest": {
  240. "index": "kibana_sample_data_ecommerce_transform_v2",
  241. "pipeline": "add_timestamp_pipeline"
  242. },
  243. "frequency": "15m",
  244. "sync": {
  245. "time": {
  246. "field": "order_date",
  247. "delay": "120s"
  248. }
  249. },
  250. "settings": { },
  251. "version": "7.5.0",
  252. "create_time": 1518808660505
  253. }
  254. ----
  255. // TESTRESPONSE[s/"version": "7.5.0"/"version": $body.version/]
  256. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]