update-transform.asciidoc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[update-transform]]
  4. === Update {transforms} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Update {transforms}</titleabbrev>
  8. ++++
  9. Updates an existing {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}. All settings except description do not
  25. take effect until after the {transform} starts the next checkpoint. This is
  26. so there is consistency with the pivoted data in each checkpoint.
  27. IMPORTANT: When {es} {security-features} are enabled, your {transform}
  28. remembers which roles the user who updated it had at the time of update and
  29. runs with those privileges.
  30. IMPORTANT: You must use {kib} or this API to update a {transform}.
  31. Do not update a {transform} directly via
  32. `.transform-internal*` indices using the Elasticsearch index API.
  33. If {es} {security-features} are enabled, do not give users any
  34. privileges on `.transform-internal*` indices. If you used transforms
  35. prior 7.5, also do not give users any privileges on
  36. `.data-frame-internal*` indices.
  37. [[update-transform-path-parms]]
  38. ==== {api-path-parms-title}
  39. `<transform_id>`::
  40. (Required, string) Identifier for the {transform}. This identifier
  41. can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and
  42. underscores. It must start and end with alphanumeric characters.
  43. [[update-transform-query-parms]]
  44. ==== {api-query-parms-title}
  45. `defer_validation`::
  46. (Optional, boolean) When `true`, deferrable validations are not run. This
  47. behavior may be desired if the source index does not exist until after the
  48. {transform} is updated.
  49. [[update-transform-request-body]]
  50. ==== {api-request-body-title}
  51. `description`::
  52. (Optional, string) Free text description of the {transform}.
  53. `dest`::
  54. (Optional, object) The destination configuration, which has the
  55. following properties:
  56. `index`:::
  57. (Required, string) The _destination index_ for the {transform}.
  58. `pipeline`:::
  59. (Optional, string) The unique identifier for a <<pipeline,pipeline>>.
  60. `frequency`::
  61. (Optional, <<time-units, time units>>) The interval between checks for changes
  62. in the source indices when the {transform} is running continuously.
  63. Also determines the retry interval in the event of transient failures while
  64. the {transform} is searching or indexing. The minimum value is `1s`
  65. and the maximum is `1h`. The default value is `1m`.
  66. `source`::
  67. (Optional, object) The source configuration, which has the following
  68. properties:
  69. `index`:::
  70. (Required, string or array) The _source indices_ for the
  71. {transform}. It can be a single index, an index pattern (for
  72. example, `"myindex*"`), or an array of indices (for example,
  73. `["index1", "index2"]`).
  74. `query`:::
  75. (Optional, object) A query clause that retrieves a subset of data from the
  76. source index. See <<query-dsl>>.
  77. `sync`::
  78. (Optional, object) Defines the properties required to run continuously.
  79. `time`:::
  80. (Required, object) Specifies that the {transform} uses a time
  81. field to synchronize the source and destination indices.
  82. `field`::::
  83. (Required, string) The date field that is used to identify new documents
  84. in the source.
  85. +
  86. --
  87. TIP: In general, it’s a good idea to use a field that contains the
  88. <<accessing-ingest-metadata,ingest timestamp>>. If you use a different field,
  89. you might need to set the `delay` such that it accounts for data transmission
  90. delays.
  91. --
  92. `delay`::::
  93. (Optional, <<time-units, time units>>) The time delay between the current
  94. time and the latest input data time. The default value is `60s`.
  95. [[update-transform-example]]
  96. ==== {api-examples-title}
  97. [source,console]
  98. --------------------------------------------------
  99. POST _transform/simple-kibana-ecomm-pivot/_update
  100. {
  101. "source": {
  102. "index": "kibana_sample_data_ecommerce",
  103. "query": {
  104. "term": {
  105. "geoip.continent_name": {
  106. "value": "Asia"
  107. }
  108. }
  109. }
  110. },
  111. "description": "Maximum priced ecommerce data by customer_id in Asia",
  112. "dest": {
  113. "index": "kibana_sample_data_ecommerce_transform_v2",
  114. "pipeline": "add_timestamp_pipeline"
  115. },
  116. "frequency": "15m",
  117. "sync": {
  118. "time": {
  119. "field": "order_date",
  120. "delay": "120s"
  121. }
  122. }
  123. }
  124. --------------------------------------------------
  125. // TEST[setup:simple_kibana_continuous_pivot]
  126. When the {transform} is updated, you receive the updated configuration:
  127. [source,console-result]
  128. ----
  129. {
  130. "id": "simple-kibana-ecomm-pivot",
  131. "source": {
  132. "index": ["kibana_sample_data_ecommerce"],
  133. "query": {
  134. "term": {
  135. "geoip.continent_name": {
  136. "value": "Asia"
  137. }
  138. }
  139. }
  140. },
  141. "pivot": {
  142. "group_by": {
  143. "customer_id": {
  144. "terms": {
  145. "field": "customer_id"
  146. }
  147. }
  148. },
  149. "aggregations": {
  150. "max_price": {
  151. "max": {
  152. "field": "taxful_total_price"
  153. }
  154. }
  155. }
  156. },
  157. "description": "Maximum priced ecommerce data by customer_id in Asia",
  158. "dest": {
  159. "index": "kibana_sample_data_ecommerce_transform_v2",
  160. "pipeline": "add_timestamp_pipeline"
  161. },
  162. "frequency": "15m",
  163. "sync": {
  164. "time": {
  165. "field": "order_date",
  166. "delay": "120s"
  167. }
  168. },
  169. "version": "8.0.0-alpha1",
  170. "create_time": 1518808660505
  171. }
  172. ----
  173. // TESTRESPONSE[s/"version": "8.0.0-alpha1"/"version": $body.version/]
  174. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]