get-overall-buckets.asciidoc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. [[java-rest-high-x-pack-ml-get-overall-buckets]]
  2. === Get Overall Buckets API
  3. The Get Overall Buckets API retrieves overall bucket results that
  4. summarize the bucket results of multiple jobs.
  5. It accepts a `GetOverallBucketsRequest` object and responds
  6. with a `GetOverallBucketsResponse` object.
  7. [[java-rest-high-x-pack-ml-get-overall-buckets-request]]
  8. ==== Get Overall Buckets Request
  9. A `GetOverallBucketsRequest` object gets created with one or more `jobId`.
  10. ["source","java",subs="attributes,callouts,macros"]
  11. --------------------------------------------------
  12. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-request]
  13. --------------------------------------------------
  14. <1> Constructing a new request referencing job IDs `jobId1` and `jobId2`.
  15. ==== Optional Arguments
  16. The following arguments are optional:
  17. ["source","java",subs="attributes,callouts,macros"]
  18. --------------------------------------------------
  19. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-bucket-span]
  20. --------------------------------------------------
  21. <1> The span of the overall buckets. Must be greater or equal to the jobs' largest `bucket_span`.
  22. ["source","java",subs="attributes,callouts,macros"]
  23. --------------------------------------------------
  24. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-end]
  25. --------------------------------------------------
  26. <1> Overall buckets with timestamps earlier than this time will be returned.
  27. ["source","java",subs="attributes,callouts,macros"]
  28. --------------------------------------------------
  29. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-exclude-interim]
  30. --------------------------------------------------
  31. <1> If `true`, interim results will be excluded. Overall buckets are interim if any of the job buckets
  32. within the overall bucket interval are interim. Defaults to `false`.
  33. ["source","java",subs="attributes,callouts,macros"]
  34. --------------------------------------------------
  35. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-overall-score]
  36. --------------------------------------------------
  37. <1> Overall buckets with overall scores greater or equal than this value will be returned.
  38. ["source","java",subs="attributes,callouts,macros"]
  39. --------------------------------------------------
  40. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-start]
  41. --------------------------------------------------
  42. <1> Overall buckets with timestamps on or after this time will be returned.
  43. ["source","java",subs="attributes,callouts,macros"]
  44. --------------------------------------------------
  45. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-top-n]
  46. --------------------------------------------------
  47. <1> The number of top job bucket scores to be used in the `overall_score` calculation. Defaults to `1`.
  48. [[java-rest-high-x-pack-ml-get-overall-buckets-execution]]
  49. ==== Execution
  50. The request can be executed through the `MachineLearningClient` contained
  51. in the `RestHighLevelClient` object, accessed via the `machineLearningClient()` method.
  52. ["source","java",subs="attributes,callouts,macros"]
  53. --------------------------------------------------
  54. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-execute]
  55. --------------------------------------------------
  56. [[java-rest-high-x-pack-ml-get-overall-buckets-execution-async]]
  57. ==== Asynchronous Execution
  58. The request can also be executed asynchronously:
  59. ["source","java",subs="attributes,callouts,macros"]
  60. --------------------------------------------------
  61. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-execute-async]
  62. --------------------------------------------------
  63. <1> The `GetOverallBucketsRequest` to execute and the `ActionListener` to use when
  64. the execution completes
  65. The asynchronous method does not block and returns immediately. Once it is
  66. completed the `ActionListener` is called back with the `onResponse` method
  67. if the execution is successful or the `onFailure` method if the execution
  68. failed.
  69. A typical listener for `GetBucketsResponse` looks like:
  70. ["source","java",subs="attributes,callouts,macros"]
  71. --------------------------------------------------
  72. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-listener]
  73. --------------------------------------------------
  74. <1> `onResponse` is called back when the action is completed successfully
  75. <2> `onFailure` is called back when some unexpected error occurs
  76. [[java-rest-high-x-pack-ml-get-overall-buckets-response]]
  77. ==== Get Overall Buckets Response
  78. The returned `GetOverallBucketsResponse` contains the requested buckets:
  79. ["source","java",subs="attributes,callouts,macros"]
  80. --------------------------------------------------
  81. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-overall-buckets-response]
  82. --------------------------------------------------
  83. <1> The count of overall buckets that were matched
  84. <2> The overall buckets retrieved