update-transform.asciidoc 7.5 KB

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