update-datafeed.asciidoc 3.7 KB

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