update-datafeed.asciidoc 3.7 KB

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