2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2018-08-31 19:49:24 -04:00
|
|
|
[testenv="platinum"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-get-job-stats]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Get job statistics API
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Get job statistics</titleabbrev>
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-06-13 16:37:35 -04:00
|
|
|
Retrieves usage information for jobs.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-job-stats-request]]
|
|
|
|
==== {api-request-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`GET _ml/anomaly_detectors/<job_id>/_stats`
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`GET _ml/anomaly_detectors/<job_id>,<job_id>/_stats` +
|
2017-08-09 11:30:21 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`GET _ml/anomaly_detectors/_stats` +
|
2017-08-09 11:30:21 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
`GET _ml/anomaly_detectors/_all/_stats`
|
|
|
|
|
|
|
|
[[ml-get-job-stats-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* If the {es} {security-features} are enabled, you must have `monitor_ml`,
|
|
|
|
`monitor`, `manage_ml`, or `manage` cluster privileges to use this API. See
|
|
|
|
{stack-ov}/security-privileges.html[Security privileges].
|
2017-08-09 11:30:21 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-job-stats-desc]]
|
|
|
|
==== {api-description-title}
|
2017-08-09 11:30:21 -04:00
|
|
|
|
|
|
|
You can get statistics for multiple jobs in a single API request by using a
|
|
|
|
group name, a comma-separated list of jobs, or a wildcard expression. You can
|
|
|
|
get statistics for all jobs by using `_all`, by specifying `*` as the
|
|
|
|
`<job_id>`, or by omitting the `<job_id>`.
|
|
|
|
|
2019-01-17 13:47:15 -05:00
|
|
|
IMPORTANT: This API returns a maximum of 10,000 jobs.
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-job-stats-path-parms]]
|
|
|
|
==== {api-path-parms-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<job_id>`::
|
|
|
|
(Optional, string) An identifier for the job. It can be a job identifier, a
|
|
|
|
group name, or a wildcard expression. If you do not specify one of these
|
|
|
|
options, the API returns statistics for all jobs.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-30 08:22:14 -04:00
|
|
|
[[ml-get-job-stats-query-parms]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
|
|
|
`allow_no_jobs`::
|
|
|
|
(Optional, boolean) Specifies what to do when the request:
|
|
|
|
+
|
|
|
|
--
|
|
|
|
* Contains wildcard expressions and there are no jobs that match.
|
|
|
|
* Contains the `_all` string or no identifiers and there are no matches.
|
|
|
|
* Contains wildcard expressions and there are only partial matches.
|
|
|
|
|
|
|
|
The default value is `true`, which returns an empty `jobs` array
|
|
|
|
when there are no matches and the subset of results when there are partial
|
|
|
|
matches. If this parameter is `false`, the request returns a `404` status code
|
|
|
|
when there are no matches or only partial matches.
|
|
|
|
--
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-job-stats-results]]
|
|
|
|
==== {api-response-body-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
The API returns the following information:
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`jobs`::
|
2017-05-08 09:53:04 -04:00
|
|
|
(array) An array of job statistics objects.
|
|
|
|
For more information, see <<ml-jobstats,Job Statistics>>.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-30 08:22:14 -04:00
|
|
|
[[ml-get-job-stats-response-codes]]
|
|
|
|
==== {api-response-codes-title}
|
|
|
|
|
|
|
|
`404` (Missing resources)::
|
|
|
|
If `allow_no_jobs` is `false`, this code indicates that there are no
|
|
|
|
resources that match the request or only partial matches for the request.
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-get-job-stats-example]]
|
|
|
|
==== {api-examples-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
The following example gets usage information for the `farequote` job:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
GET _ml/anomaly_detectors/farequote/_stats
|
2017-04-11 21:52:47 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
2017-05-08 09:53:04 -04:00
|
|
|
The API returns the following results:
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
|
|
|
"count": 1,
|
|
|
|
"jobs": [
|
|
|
|
{
|
2017-04-11 21:52:47 -04:00
|
|
|
"job_id": "farequote",
|
2017-04-04 18:26:39 -04:00
|
|
|
"data_counts": {
|
2017-04-11 21:52:47 -04:00
|
|
|
"job_id": "farequote",
|
|
|
|
"processed_record_count": 86275,
|
|
|
|
"processed_field_count": 172550,
|
|
|
|
"input_bytes": 6744714,
|
|
|
|
"input_field_count": 172550,
|
2017-04-04 18:26:39 -04:00
|
|
|
"invalid_date_count": 0,
|
|
|
|
"missing_field_count": 0,
|
|
|
|
"out_of_order_timestamp_count": 0,
|
|
|
|
"empty_bucket_count": 0,
|
2017-04-11 21:52:47 -04:00
|
|
|
"sparse_bucket_count": 15,
|
|
|
|
"bucket_count": 1528,
|
|
|
|
"earliest_record_timestamp": 1454803200000,
|
|
|
|
"latest_record_timestamp": 1455235196000,
|
|
|
|
"last_data_time": 1491948163685,
|
|
|
|
"latest_sparse_bucket_timestamp": 1455174900000,
|
|
|
|
"input_record_count": 86275
|
2017-04-04 18:26:39 -04:00
|
|
|
},
|
|
|
|
"model_size_stats": {
|
2017-04-11 21:52:47 -04:00
|
|
|
"job_id": "farequote",
|
2017-04-04 18:26:39 -04:00
|
|
|
"result_type": "model_size_stats",
|
2017-04-11 21:52:47 -04:00
|
|
|
"model_bytes": 387594,
|
|
|
|
"total_by_field_count": 21,
|
2017-04-04 18:26:39 -04:00
|
|
|
"total_over_field_count": 0,
|
2017-04-11 21:52:47 -04:00
|
|
|
"total_partition_field_count": 20,
|
2017-04-04 18:26:39 -04:00
|
|
|
"bucket_allocation_failures_count": 0,
|
|
|
|
"memory_status": "ok",
|
2017-04-11 21:52:47 -04:00
|
|
|
"log_time": 1491948163000,
|
|
|
|
"timestamp": 1455234600000
|
2017-04-04 18:26:39 -04:00
|
|
|
},
|
2019-06-17 02:58:26 -04:00
|
|
|
"state": "closed",
|
|
|
|
"timing_stats": {
|
|
|
|
"job_id": "farequote",
|
|
|
|
"minimum_bucket_processing_time_ms": 0.0,
|
|
|
|
"maximum_bucket_processing_time_ms": 15.0,
|
|
|
|
"average_bucket_processing_time_ms": 8.75,
|
|
|
|
"exponential_average_bucket_processing_time_ms": 6.1435899
|
|
|
|
}
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|