flush-job.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-flush-job]]
  4. = Flush jobs API
  5. ++++
  6. <titleabbrev>Flush jobs</titleabbrev>
  7. ++++
  8. Forces any buffered data to be processed by the job.
  9. [[ml-flush-job-request]]
  10. == {api-request-title}
  11. `POST _ml/anomaly_detectors/<job_id>/_flush`
  12. [[ml-flush-job-prereqs]]
  13. == {api-prereq-title}
  14. * If the {es} {security-features} are enabled, you must have `manage_ml` or
  15. `manage` cluster privileges to use this API. See
  16. <<security-privileges>> and {ml-docs-setup-privileges}.
  17. [[ml-flush-job-desc]]
  18. == {api-description-title}
  19. The flush jobs API is only applicable when sending data for analysis using the
  20. <<ml-post-data,post data API>>. Depending on the content of the buffer, then it
  21. might additionally calculate new results.
  22. Both flush and close operations are similar, however the flush is more efficient
  23. if you are expecting to send more data for analysis. When flushing, the job
  24. remains open and is available to continue analyzing data. A close operation
  25. additionally prunes and persists the model state to disk and the job must be
  26. opened again before analyzing further data.
  27. [[ml-flush-job-path-parms]]
  28. == {api-path-parms-title}
  29. `<job_id>`::
  30. (Required, string)
  31. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  32. [[ml-flush-job-query-parms]]
  33. == {api-query-parms-title}
  34. `advance_time`::
  35. (string) Optional. Specifies to advance to a particular time value. Results are
  36. generated and the model is updated for data from the specified time interval.
  37. `calc_interim`::
  38. (boolean) Optional. If true, calculates the interim results for the most
  39. recent bucket or all buckets within the latency period.
  40. `end`::
  41. (string) Optional. When used in conjunction with `calc_interim`, specifies the
  42. range of buckets on which to calculate interim results.
  43. `skip_time`::
  44. (string) Optional. Specifies to skip to a particular time value. Results are
  45. not generated and the model is not updated for data from the specified time
  46. interval.
  47. `start`::
  48. (string) Optional. When used in conjunction with `calc_interim`, specifies the
  49. range of buckets on which to calculate interim results.
  50. [[ml-flush-job-example]]
  51. == {api-examples-title}
  52. [source,console]
  53. --------------------------------------------------
  54. POST _ml/anomaly_detectors/low_request_rate/_flush
  55. {
  56. "calc_interim": true
  57. }
  58. --------------------------------------------------
  59. // TEST[skip:Kibana sample data]
  60. When the operation succeeds, you receive the following results:
  61. [source,console-result]
  62. ----
  63. {
  64. "flushed": true,
  65. "last_finalized_bucket_end": 1455234900000
  66. }
  67. ----
  68. //TESTRESPONSE[s/"last_finalized_bucket_end": 1455234900000/"last_finalized_bucket_end": $body.last_finalized_bucket_end/]
  69. The `last_finalized_bucket_end` provides the timestamp (in
  70. milliseconds-since-the-epoch) of the end of the last bucket that was processed.
  71. If you want to flush the job to a specific timestamp, you can use the
  72. `advance_time` or `skip_time` parameters. For example, to advance to 11 AM GMT
  73. on January 1, 2018:
  74. [source,console]
  75. --------------------------------------------------
  76. POST _ml/anomaly_detectors/total-requests/_flush
  77. {
  78. "advance_time": "1514804400000"
  79. }
  80. --------------------------------------------------
  81. // TEST[skip:setup:server_metrics_openjob]
  82. When the operation succeeds, you receive the following results:
  83. [source,console-result]
  84. ----
  85. {
  86. "flushed": true,
  87. "last_finalized_bucket_end": 1514804400000
  88. }
  89. ----