-- :api: get-job-stats :request: GetJobStatsRequest :response: GetJobStatsResponse -- [role="xpack"] [id="{upid}-{api}"] === Get {anomaly-job} stats API Retrieves statistics for any number of {anomaly-jobs} in the cluster. It accepts a +{request}+ object and responds with a +{response}+ object. [id="{upid}-{api}-request"] ==== Get {anomaly-job} stats request A `GetJobsStatsRequest` object can have any number of `jobId` entries. However, they all must be non-null. An empty list is the same as requesting statistics for all {anomaly-jobs}. ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests-file}[{api}-request] -------------------------------------------------- <1> Constructing a new request referencing existing `jobIds`. It can contain wildcards. <2> Whether to ignore if a wildcard expression matches no {anomaly-jobs}. (This includes `_all` string or when no jobs have been specified). include::../execution.asciidoc[] [id="{upid}-{api}-response"] ==== Get {anomaly-job} stats response The returned +{response}+ contains the requested job statistics: ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests-file}[{api}-response] -------------------------------------------------- <1> `getCount()` indicates the number of jobs statistics found. <2> `getJobStats()` is the collection of {ml} `JobStats` objects found.