update-datafeed.asciidoc 3.8 KB

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