get-job.asciidoc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-job]]
  4. === Get {anomaly-jobs} API
  5. ++++
  6. <titleabbrev>Get jobs</titleabbrev>
  7. ++++
  8. Retrieves configuration information for {anomaly-jobs}.
  9. [[ml-get-job-request]]
  10. ==== {api-request-title}
  11. `GET _ml/anomaly_detectors/<job_id>` +
  12. `GET _ml/anomaly_detectors/<job_id>,<job_id>` +
  13. `GET _ml/anomaly_detectors/` +
  14. `GET _ml/anomaly_detectors/_all`
  15. [[ml-get-job-prereqs]]
  16. ==== {api-prereq-title}
  17. * If the {es} {security-features} are enabled, you must have `monitor_ml`,
  18. `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. See
  19. <<security-privileges>>.
  20. [[ml-get-job-desc]]
  21. ==== {api-description-title}
  22. You can get information for multiple {anomaly-jobs} in a single API request by
  23. using a group name, a comma-separated list of jobs, or a wildcard expression.
  24. You can get information for all {anomaly-jobs} by using `_all`, by specifying
  25. `*` as the `<job_id>`, or by omitting the `<job_id>`.
  26. IMPORTANT: This API returns a maximum of 10,000 jobs.
  27. [[ml-get-job-path-parms]]
  28. ==== {api-path-parms-title}
  29. `<job_id>`::
  30. (Optional, string)
  31. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-default]
  32. [[ml-get-job-query-parms]]
  33. ==== {api-query-parms-title}
  34. `allow_no_jobs`::
  35. (Optional, boolean)
  36. include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
  37. [[ml-get-job-results]]
  38. ==== {api-response-body-title}
  39. The API returns an array of {anomaly-job} resources. For the full list of
  40. properties, see <<ml-put-job-request-body,create {anomaly-jobs} API>>.
  41. `create_time`::
  42. (string) The time the job was created. For example, `1491007356077`. This
  43. property is informational; you cannot change its value.
  44. `finished_time`::
  45. (string) If the job closed or failed, this is the time the job finished,
  46. otherwise it is `null`. This property is informational; you cannot change its
  47. value.
  48. `job_type`::
  49. (string) Reserved for future use, currently set to `anomaly_detector`.
  50. `job_version`::
  51. (string) The version of {es} that existed on the node when the job was created.
  52. `model_snapshot_id`::
  53. (string)
  54. include::{docdir}/ml/ml-shared.asciidoc[tag=model-snapshot-id]
  55. [[ml-get-job-response-codes]]
  56. ==== {api-response-codes-title}
  57. `404` (Missing resources)::
  58. If `allow_no_jobs` is `false`, this code indicates that there are no
  59. resources that match the request or only partial matches for the request.
  60. [[ml-get-job-example]]
  61. ==== {api-examples-title}
  62. //The following example gets configuration information for the `total-requests` job:
  63. [source,console]
  64. --------------------------------------------------
  65. GET _ml/anomaly_detectors/high_sum_total_sales
  66. --------------------------------------------------
  67. // TEST[skip:Kibana sample data]
  68. The API returns the following results:
  69. [source,js]
  70. ----
  71. {
  72. "count": 1,
  73. "jobs": [
  74. {
  75. "job_id" : "high_sum_total_sales",
  76. "job_type" : "anomaly_detector",
  77. "job_version" : "8.0.0",
  78. "groups" : [
  79. "kibana_sample_data",
  80. "kibana_sample_ecommerce"
  81. ],
  82. "description" : "Find customers spending an unusually high amount in an hour",
  83. "create_time" : 1575402224732,
  84. "finished_time" : 1575402238311,
  85. "analysis_config" : {
  86. "bucket_span" : "1h",
  87. "detectors" : [
  88. {
  89. "detector_description" : "High total sales",
  90. "function" : "high_sum",
  91. "field_name" : "taxful_total_price",
  92. "over_field_name" : "customer_full_name.keyword",
  93. "detector_index" : 0
  94. }
  95. ],
  96. "influencers" : [
  97. "customer_full_name.keyword",
  98. "category.keyword"
  99. ]
  100. },
  101. "analysis_limits" : {
  102. "model_memory_limit" : "10mb",
  103. "categorization_examples_limit" : 4
  104. },
  105. "data_description" : {
  106. "time_field" : "order_date",
  107. "time_format" : "epoch_ms"
  108. },
  109. "model_plot_config" : {
  110. "enabled" : true
  111. },
  112. "model_snapshot_retention_days" : 1,
  113. "custom_settings" : {
  114. "created_by" : "ml-module-sample",
  115. ...
  116. },
  117. "model_snapshot_id" : "1575402237",
  118. "results_index_name" : "shared",
  119. "allow_lazy_open" : false
  120. }
  121. ]
  122. }
  123. ----