[[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//_stats` //// ===== Description TBD //// ===== Path Parameters `job_id`:: (+string+) Identifier for the job. If you do not specify this optional parameter, the API returns information about all jobs that you have authority to view. ===== Results The API returns the following usage information: `job_id`:: (+string+) A numerical character string that uniquely identifies the job. `data_counts`:: (+object+) An object that describes the number of records processed and any related error counts. See <>. `model_size_stats`:: (+object+) An object that provides information about the size and contents of the model. See <> `state`:: (+string+) The status of the job, which can be one of the following values: running:: The job is actively receiving and processing data. closed:: The job finished successfully with its model state persisted. The job is still available to accept further data. NOTE: If you send data in a periodic cycle and close the job at the end of each transaction, the job is marked as closed in the intervals between when data is sent. For example, if data is sent every minute and it takes 1 second to process, the job has a closed state for 59 seconds. failed:: The job did not finish successfully due to an error. NOTE: This can occur due to invalid input data. In this case, sending corrected data to a failed job re-opens the job and resets it to a running state. //// ===== 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 .Example results for a single job ---- { "count": 1, "jobs": [ { "job_id": "it-ops-kpi", "data_counts": { "job_id": "it-ops", "processed_record_count": 43272, "processed_field_count": 86544, "input_bytes": 2846163, "input_field_count": 86544, "invalid_date_count": 0, "missing_field_count": 0, "out_of_order_timestamp_count": 0, "empty_bucket_count": 0, "sparse_bucket_count": 0, "bucket_count": 4329, "earliest_record_timestamp": 1454020560000, "latest_record_timestamp": 1455318900000, "last_data_time": 1491235405945, "input_record_count": 43272 }, "model_size_stats": { "job_id": "it-ops", "result_type": "model_size_stats", "model_bytes": 25586, "total_by_field_count": 3, "total_over_field_count": 0, "total_partition_field_count": 2, "bucket_allocation_failures_count": 0, "memory_status": "ok", "log_time": 1491235406000, "timestamp": 1455318600000 }, "state": "closed" } ] } ----