update-datafeed.asciidoc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. * If {es} {security-features} are enabled, you must have `manage_ml`, or `manage`
  16. cluster privileges to use this API. See
  17. <<security-privileges>>.
  18. [[ml-update-datafeed-desc]]
  19. ==== {api-description-title}
  20. If you update a {dfeed} property, you must stop and start the {dfeed} for the
  21. change to be applied.
  22. IMPORTANT: When {es} {security-features} are enabled, your {dfeed} remembers
  23. which roles the user who updated it had at the time of update and runs the query
  24. using those same roles.
  25. [[ml-update-datafeed-path-parms]]
  26. ==== {api-path-parms-title}
  27. `<feed_id>`::
  28. (Required, string)
  29. include::{docdir}/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::{docdir}/ml/ml-shared.asciidoc[tag=aggregations]
  37. `chunking_config`::
  38. (Optional, object)
  39. include::{docdir}/ml/ml-shared.asciidoc[tag=chunking-config]
  40. `delayed_data_check_config`::
  41. (Optional, object)
  42. include::{docdir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config]
  43. `frequency`::
  44. (Optional, <<time-units, time units>>)
  45. include::{docdir}/ml/ml-shared.asciidoc[tag=frequency]
  46. `indices`::
  47. (Optional, array)
  48. include::{docdir}/ml/ml-shared.asciidoc[tag=indices]
  49. `max_empty_searches`::
  50. (Optional, integer)
  51. include::{docdir}/ml/ml-shared.asciidoc[tag=max-empty-searches]
  52. +
  53. --
  54. The special value `-1` unsets this setting.
  55. --
  56. `query`::
  57. (Optional, object)
  58. include::{docdir}/ml/ml-shared.asciidoc[tag=query]
  59. +
  60. --
  61. WARNING: If you change the query, the analyzed data is also changed. Therefore,
  62. the required time to learn might be long and the understandability of the
  63. results is unpredictable. If you want to make significant changes to the source
  64. data, we would recommend you clone it and create a second job containing the
  65. amendments. Let both run in parallel and close one when you are satisfied with
  66. the results of the other job.
  67. --
  68. `query_delay`::
  69. (Optional, <<time-units, time units>>)
  70. include::{docdir}/ml/ml-shared.asciidoc[tag=query-delay]
  71. `script_fields`::
  72. (Optional, object)
  73. include::{docdir}/ml/ml-shared.asciidoc[tag=script-fields]
  74. `scroll_size`::
  75. (Optional, unsigned integer)
  76. include::{docdir}/ml/ml-shared.asciidoc[tag=scroll-size]
  77. `indices_options`::
  78. (Optional, object)
  79. include::{docdir}/ml/ml-shared.asciidoc[tag=indices-options]
  80. [[ml-update-datafeed-example]]
  81. ==== {api-examples-title}
  82. [source,console]
  83. --------------------------------------------------
  84. POST _ml/datafeeds/datafeed-total-requests/_update
  85. {
  86. "query": {
  87. "term": {
  88. "level": "error"
  89. }
  90. }
  91. }
  92. --------------------------------------------------
  93. // TEST[skip:setup:server_metrics_datafeed]
  94. When the {dfeed} is updated, you receive the full {dfeed} configuration with
  95. with the updated values:
  96. [source,console-result]
  97. ----
  98. {
  99. "datafeed_id": "datafeed-total-requests",
  100. "job_id": "total-requests",
  101. "query_delay": "83474ms",
  102. "indices": ["server-metrics"],
  103. "query": {
  104. "term": {
  105. "level": {
  106. "value": "error",
  107. "boost": 1.0
  108. }
  109. }
  110. },
  111. "scroll_size": 1000,
  112. "chunking_config": {
  113. "mode": "auto"
  114. }
  115. }
  116. ----
  117. // TESTRESPONSE[s/"query.boost": "1.0"/"query.boost": $body.query.boost/]