OpenSearch/docs/en/rest-api/ml/get-job-stats.asciidoc

99 lines
2.6 KiB
Plaintext

//lcawley Verified example output 2017-04-11
[[ml-get-job-stats]]
==== Get Job Statistics
The get jobs API allows you to retrieve usage information for jobs.
===== Request
`GET _xpack/ml/anomaly_detectors/_stats` +
`GET _xpack/ml/anomaly_detectors/<job_id>/_stats`
===== Description
You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
privileges to use this API. For more information, see <<privileges-list-cluster>>.
===== Path Parameters
`job_id`::
(string) Identifier for the job. If you do not specify this optional parameter,
the API returns information about all jobs.
===== Results
The API returns the following information:
`jobs`::
(array) An array of job count objects.
For more information, see <<ml-jobstats,Job Stats>>.
////
===== Responses
200
(EmptyResponse) The cluster has been successfully deleted
404
(BasicFailedReply) The cluster specified by {cluster_id} cannot be found (code: clusters.cluster_not_found)
412
(BasicFailedReply) The Elasticsearch cluster has not been shutdown yet (code: clusters.cluster_plan_state_error)
////
===== Examples
The following example gets usage information for the `farequote` job:
[source,js]
--------------------------------------------------
GET _xpack/ml/anomaly_detectors/farequote/_stats
--------------------------------------------------
// CONSOLE
// TEST[skip:todo]
In this example, the API returns a single result that matches the specified
score and time constraints:
[source,js]
----
{
"count": 1,
"jobs": [
{
"job_id": "farequote",
"data_counts": {
"job_id": "farequote",
"processed_record_count": 86275,
"processed_field_count": 172550,
"input_bytes": 6744714,
"input_field_count": 172550,
"invalid_date_count": 0,
"missing_field_count": 0,
"out_of_order_timestamp_count": 0,
"empty_bucket_count": 0,
"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
},
"model_size_stats": {
"job_id": "farequote",
"result_type": "model_size_stats",
"model_bytes": 387594,
"total_by_field_count": 21,
"total_over_field_count": 0,
"total_partition_field_count": 20,
"bucket_allocation_failures_count": 0,
"memory_status": "ok",
"log_time": 1491948163000,
"timestamp": 1455234600000
},
"state": "closed"
}
]
}
----