update-datafeed.asciidoc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. [role="xpack"]
  2. [[ml-update-datafeed]]
  3. = Update {dfeeds} API
  4. [subs="attributes"]
  5. ++++
  6. <titleabbrev>Update {dfeeds}</titleabbrev>
  7. ++++
  8. Updates certain properties of a {dfeed}.
  9. [[ml-update-datafeed-request]]
  10. == {api-request-title}
  11. `POST _ml/datafeeds/<feed_id>/_update`
  12. [[ml-update-datafeed-prereqs]]
  13. == {api-prereq-title}
  14. Requires the `manage_ml` cluster privilege. This privilege is included in the
  15. `machine_learning_admin` built-in role.
  16. [[ml-update-datafeed-desc]]
  17. == {api-description-title}
  18. If you update a {dfeed} property, you must stop and start the {dfeed} for the
  19. change to be applied.
  20. IMPORTANT: When {es} {security-features} are enabled, your {dfeed} remembers
  21. which roles the user who updated it had at the time of update and runs the query
  22. using those same roles. If you provide
  23. <<http-clients-secondary-authorization,secondary authorization headers>>, those
  24. credentials are used instead.
  25. [[ml-update-datafeed-path-parms]]
  26. == {api-path-parms-title}
  27. `<feed_id>`::
  28. (Required, string)
  29. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=datafeed-id]
  30. [[ml-update-datafeed-query-params]]
  31. == {api-query-parms-title}
  32. `allow_no_indices`::
  33. (Optional, Boolean) If `true`, wildcard indices expressions that resolve into no
  34. concrete indices are ignored. This includes the `_all` string or when no indices
  35. are specified. Defaults to `true`.
  36. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  37. +
  38. Defaults to `open`.
  39. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=ignore_throttled]
  40. +
  41. deprecated:[7.16.0]
  42. `ignore_unavailable`::
  43. (Optional, Boolean) If `true`, unavailable indices (missing or closed) are
  44. ignored. Defaults to `false`.
  45. [role="child_attributes"]
  46. [[ml-update-datafeed-request-body]]
  47. == {api-request-body-title}
  48. The following properties can be updated after the {dfeed} is created:
  49. `aggregations`::
  50. (Optional, object)
  51. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=aggregations]
  52. `chunking_config`::
  53. (Optional, object)
  54. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=chunking-config]
  55. +
  56. .Properties of `chunking_config`
  57. [%collapsible%open]
  58. ====
  59. `mode`:::
  60. (string)
  61. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=mode]
  62. `time_span`:::
  63. (<<time-units,time units>>)
  64. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=time-span]
  65. ====
  66. `delayed_data_check_config`::
  67. (Optional, object)
  68. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config]
  69. +
  70. .Properties of `delayed_data_check_config`
  71. [%collapsible%open]
  72. ====
  73. `check_window`::
  74. (<<time-units,time units>>)
  75. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-check-window]
  76. `enabled`::
  77. (Boolean)
  78. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-enabled]
  79. ====
  80. `frequency`::
  81. (Optional, <<time-units, time units>>)
  82. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=frequency]
  83. `indices`::
  84. (Optional, array)
  85. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices]
  86. `indices_options`::
  87. (Optional, object)
  88. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices-options]
  89. `max_empty_searches`::
  90. (Optional, integer)
  91. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=max-empty-searches]
  92. +
  93. --
  94. The special value `-1` unsets this setting.
  95. --
  96. `query`::
  97. (Optional, object)
  98. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query]
  99. +
  100. --
  101. WARNING: If you change the query, the analyzed data is also changed. Therefore,
  102. the required time to learn might be long and the understandability of the
  103. results is unpredictable. If you want to make significant changes to the source
  104. data, we would recommend you clone it and create a second job containing the
  105. amendments. Let both run in parallel and close one when you are satisfied with
  106. the results of the other job.
  107. --
  108. `query_delay`::
  109. (Optional, <<time-units, time units>>)
  110. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query-delay]
  111. `runtime_mappings`::
  112. (Optional, object)
  113. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=runtime-mappings]
  114. `script_fields`::
  115. (Optional, object)
  116. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=script-fields]
  117. `scroll_size`::
  118. (Optional, unsigned integer)
  119. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=scroll-size]
  120. [[ml-update-datafeed-example]]
  121. == {api-examples-title}
  122. [source,console]
  123. --------------------------------------------------
  124. POST _ml/datafeeds/datafeed-total-requests/_update
  125. {
  126. "query": {
  127. "term": {
  128. "level": "error"
  129. }
  130. }
  131. }
  132. --------------------------------------------------
  133. // TEST[skip:setup:server_metrics_datafeed]
  134. When the {dfeed} is updated, you receive the full {dfeed} configuration with
  135. the updated values:
  136. [source,console-result]
  137. ----
  138. {
  139. "datafeed_id": "datafeed-total-requests",
  140. "job_id": "total-requests",
  141. "query_delay": "83474ms",
  142. "indices": ["server-metrics"],
  143. "query": {
  144. "term": {
  145. "level": {
  146. "value": "error",
  147. "boost": 1.0
  148. }
  149. }
  150. },
  151. "scroll_size": 1000,
  152. "chunking_config": {
  153. "mode": "auto"
  154. }
  155. }
  156. ----
  157. // TESTRESPONSE[s/"query.boost": "1.0"/"query.boost": $body.query.boost/]