update-datafeed.asciidoc 4.3 KB

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