update-transform.asciidoc 5.6 KB

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