update-transform.asciidoc 7.3 KB

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