update-transform.asciidoc 5.9 KB

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