update-transform.asciidoc 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. beta[]
  11. [[update-transform-request]]
  12. ==== {api-request-title}
  13. `POST _transform/<transform_id>/_update`
  14. [[update-transform-prereqs]]
  15. ==== {api-prereq-title}
  16. * If the {es} {security-features} are enabled, you must have `manage_transform`
  17. cluster privileges to use this API. The built-in `transform_admin` role has
  18. these privileges. You must also have `read` and `view_index_metadata`
  19. privileges on the source index and `read`, `create_index`, and `index`
  20. privileges on the destination index. For more information, see
  21. <<security-privileges>> and <<built-in-roles>>.
  22. [[update-transform-desc]]
  23. ==== {api-description-title}
  24. This API updates an existing {transform}. The list of properties that you can
  25. update is a subset of the list that you can define when you create a {transform}.
  26. When the {transform} is updated, a series of validations occur to ensure its
  27. success. You can use the `defer_validation` parameter to skip these checks.
  28. All updated properties except description do not take effect until after the
  29. {transform} starts the next checkpoint. This is so there is consistency with the
  30. pivoted data in each checkpoint.
  31. [IMPORTANT]
  32. ====
  33. * When {es} {security-features} are enabled, your {transform} remembers which
  34. roles the user who updated it had at the time of update and runs with those
  35. privileges.
  36. * You must use {kib} or this API to update a {transform}. Do not update a
  37. {transform} directly via `.transform-internal*` indices using the {es} index API.
  38. If {es} {security-features} are enabled, do not give users any privileges on
  39. `.transform-internal*` indices. If you used {transforms} prior 7.5, also do not
  40. give users any privileges on `.data-frame-internal*` indices.
  41. ====
  42. [[update-transform-path-parms]]
  43. ==== {api-path-parms-title}
  44. `<transform_id>`::
  45. (Required, string)
  46. include::{docdir}/rest-api/common-parms.asciidoc[tag=transform-id]
  47. [[update-transform-query-parms]]
  48. ==== {api-query-parms-title}
  49. `defer_validation`::
  50. (Optional, boolean) When `true`, deferrable validations are not run. This
  51. behavior may be desired if the source index does not exist until after the
  52. {transform} is updated.
  53. [[update-transform-request-body]]
  54. ==== {api-request-body-title}
  55. `description`::
  56. (Optional, string) Free text description of the {transform}.
  57. `dest`::
  58. (Optional, object)
  59. include::{docdir}/rest-api/common-parms.asciidoc[tag=dest]
  60. `dest`.`index`:::
  61. (Required, string)
  62. include::{docdir}/rest-api/common-parms.asciidoc[tag=dest-index]
  63. `dest`.`pipeline`:::
  64. (Optional, string)
  65. include::{docdir}/rest-api/common-parms.asciidoc[tag=dest-pipeline]
  66. `frequency`::
  67. (Optional, <<time-units, time units>>)
  68. include::{docdir}/rest-api/common-parms.asciidoc[tag=frequency]
  69. `source`::
  70. (Optional, object)
  71. include::{docdir}/rest-api/common-parms.asciidoc[tag=source-transforms]
  72. `source`.`index`:::
  73. (Required, string or array)
  74. include::{docdir}/rest-api/common-parms.asciidoc[tag=source-index-transforms]
  75. `source`.`query`:::
  76. (Optional, object)
  77. include::{docdir}/rest-api/common-parms.asciidoc[tag=source-query-transforms]
  78. `sync`::
  79. (Optional, object)
  80. include::{docdir}/rest-api/common-parms.asciidoc[tag=sync]
  81. `sync`.`time`:::
  82. (Required, object)
  83. include::{docdir}/rest-api/common-parms.asciidoc[tag=sync-time]
  84. `sync`.`time`.`delay`::::
  85. (Optional, <<time-units, time units>>)
  86. include::{docdir}/rest-api/common-parms.asciidoc[tag=sync-time-delay]
  87. `sync`.`time`.`field`::::
  88. (Required, string)
  89. include::{docdir}/rest-api/common-parms.asciidoc[tag=sync-time-field]
  90. +
  91. --
  92. TIP: In general, it’s a good idea to use a field that contains the
  93. <<accessing-ingest-metadata,ingest timestamp>>. If you use a different field,
  94. you might need to set the `delay` such that it accounts for data transmission
  95. delays.
  96. --
  97. [[update-transform-example]]
  98. ==== {api-examples-title}
  99. [source,console]
  100. --------------------------------------------------
  101. POST _transform/simple-kibana-ecomm-pivot/_update
  102. {
  103. "source": {
  104. "index": "kibana_sample_data_ecommerce",
  105. "query": {
  106. "term": {
  107. "geoip.continent_name": {
  108. "value": "Asia"
  109. }
  110. }
  111. }
  112. },
  113. "description": "Maximum priced ecommerce data by customer_id in Asia",
  114. "dest": {
  115. "index": "kibana_sample_data_ecommerce_transform_v2",
  116. "pipeline": "add_timestamp_pipeline"
  117. },
  118. "frequency": "15m",
  119. "sync": {
  120. "time": {
  121. "field": "order_date",
  122. "delay": "120s"
  123. }
  124. }
  125. }
  126. --------------------------------------------------
  127. // TEST[setup:simple_kibana_continuous_pivot]
  128. When the {transform} is updated, you receive the updated configuration:
  129. [source,console-result]
  130. ----
  131. {
  132. "id": "simple-kibana-ecomm-pivot",
  133. "source": {
  134. "index": ["kibana_sample_data_ecommerce"],
  135. "query": {
  136. "term": {
  137. "geoip.continent_name": {
  138. "value": "Asia"
  139. }
  140. }
  141. }
  142. },
  143. "pivot": {
  144. "group_by": {
  145. "customer_id": {
  146. "terms": {
  147. "field": "customer_id"
  148. }
  149. }
  150. },
  151. "aggregations": {
  152. "max_price": {
  153. "max": {
  154. "field": "taxful_total_price"
  155. }
  156. }
  157. }
  158. },
  159. "description": "Maximum priced ecommerce data by customer_id in Asia",
  160. "dest": {
  161. "index": "kibana_sample_data_ecommerce_transform_v2",
  162. "pipeline": "add_timestamp_pipeline"
  163. },
  164. "frequency": "15m",
  165. "sync": {
  166. "time": {
  167. "field": "order_date",
  168. "delay": "120s"
  169. }
  170. },
  171. "version": "7.5.0",
  172. "create_time": 1518808660505
  173. }
  174. ----
  175. // TESTRESPONSE[s/"version": "7.5.0"/"version": $body.version/]
  176. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]