update-datafeed.asciidoc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. [role="child_attributes"]
  31. [[ml-update-datafeed-request-body]]
  32. == {api-request-body-title}
  33. The following properties can be updated after the {dfeed} is created:
  34. `aggregations`::
  35. (Optional, object)
  36. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=aggregations]
  37. `chunking_config`::
  38. (Optional, object)
  39. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=chunking-config]
  40. +
  41. .Properties of `chunking_config`
  42. [%collapsible%open]
  43. ====
  44. `mode`:::
  45. (string)
  46. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=mode]
  47. `time_span`:::
  48. (<<time-units,time units>>)
  49. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=time-span]
  50. ====
  51. `delayed_data_check_config`::
  52. (Optional, object)
  53. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config]
  54. +
  55. .Properties of `delayed_data_check_config`
  56. [%collapsible%open]
  57. ====
  58. `check_window`::
  59. (<<time-units,time units>>)
  60. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-check-window]
  61. `enabled`::
  62. (Boolean)
  63. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-enabled]
  64. ====
  65. `frequency`::
  66. (Optional, <<time-units, time units>>)
  67. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=frequency]
  68. `indices`::
  69. (Optional, array)
  70. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices]
  71. `indices_options`::
  72. (Optional, object)
  73. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices-options]
  74. `max_empty_searches`::
  75. (Optional, integer)
  76. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=max-empty-searches]
  77. +
  78. --
  79. The special value `-1` unsets this setting.
  80. --
  81. `query`::
  82. (Optional, object)
  83. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query]
  84. +
  85. --
  86. WARNING: If you change the query, the analyzed data is also changed. Therefore,
  87. the required time to learn might be long and the understandability of the
  88. results is unpredictable. If you want to make significant changes to the source
  89. data, we would recommend you clone it and create a second job containing the
  90. amendments. Let both run in parallel and close one when you are satisfied with
  91. the results of the other job.
  92. --
  93. `query_delay`::
  94. (Optional, <<time-units, time units>>)
  95. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query-delay]
  96. `runtime_mappings`::
  97. (Optional, object)
  98. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=runtime-mappings]
  99. `script_fields`::
  100. (Optional, object)
  101. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=script-fields]
  102. `scroll_size`::
  103. (Optional, unsigned integer)
  104. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=scroll-size]
  105. [[ml-update-datafeed-example]]
  106. == {api-examples-title}
  107. [source,console]
  108. --------------------------------------------------
  109. POST _ml/datafeeds/datafeed-total-requests/_update
  110. {
  111. "query": {
  112. "term": {
  113. "level": "error"
  114. }
  115. }
  116. }
  117. --------------------------------------------------
  118. // TEST[skip:setup:server_metrics_datafeed]
  119. When the {dfeed} is updated, you receive the full {dfeed} configuration with
  120. the updated values:
  121. [source,console-result]
  122. ----
  123. {
  124. "datafeed_id": "datafeed-total-requests",
  125. "job_id": "total-requests",
  126. "query_delay": "83474ms",
  127. "indices": ["server-metrics"],
  128. "query": {
  129. "term": {
  130. "level": {
  131. "value": "error",
  132. "boost": 1.0
  133. }
  134. }
  135. },
  136. "scroll_size": 1000,
  137. "chunking_config": {
  138. "mode": "auto"
  139. }
  140. }
  141. ----
  142. // TESTRESPONSE[s/"query.boost": "1.0"/"query.boost": $body.query.boost/]