123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- [role="xpack"]
- [[ml-get-job]]
- = Get {anomaly-jobs} API
- ++++
- <titleabbrev>Get jobs</titleabbrev>
- ++++
- Retrieves configuration information for {anomaly-jobs}.
- [[ml-get-job-request]]
- == {api-request-title}
- `GET _ml/anomaly_detectors/<job_id>` +
- `GET _ml/anomaly_detectors/<job_id>,<job_id>` +
- `GET _ml/anomaly_detectors/` +
- `GET _ml/anomaly_detectors/_all`
- [[ml-get-job-prereqs]]
- == {api-prereq-title}
- Requires the `monitor_ml` cluster privilege. This privilege is included in the
- `machine_learning_user` built-in role.
- [[ml-get-job-desc]]
- == {api-description-title}
- IMPORTANT: This API returns a maximum of 10,000 jobs.
- [[ml-get-job-path-parms]]
- == {api-path-parms-title}
- `<job_id>`::
- (Optional, string)
- Identifier for the anomaly detection job. It can be a job identifier, a group
- name, or a wildcard expression. You can get information for multiple
- {anomaly-jobs} in a single API request by using a group name, a comma-separated
- list of jobs, or a wildcard expression. You can get information for all
- {anomaly-jobs} by using `_all`, by specifying `*` as the job identifier, or by
- omitting the identifier.
- [[ml-get-job-query-parms]]
- == {api-query-parms-title}
- `allow_no_match`::
- (Optional, Boolean)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-match-jobs]
- `exclude_generated`::
- (Optional, Boolean)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-generated]
- [role="child_attributes"]
- [[ml-get-job-results]]
- == {api-response-body-title}
- The API returns an array of {anomaly-job} resources. For the full list of
- properties, see <<ml-put-job-request-body,create {anomaly-jobs} API>>.
- //Begin blocked
- `blocked`::
- (object) When present, it explains that a task is executed on the job
- that blocks it from opening.
- +
- .Properties of `blocked`
- [%collapsible%open]
- ====
- `reason`:::
- (string) The reason the job is blocked. Values may be `delete`, `reset`, `revert`.
- Each value means the corresponding action is being executed.
- `task_id`:::
- (string) The task id of the blocking action. You can use the <<tasks>> API to
- monitor progress.
- ====
- //End blocked
- `create_time`::
- (string) The time the job was created. For example, `1491007356077`. This
- property is informational; you cannot change its value.
- `datafeed_config`::
- (object) The {dfeed} configured for the current {anomaly-job}.
- +
- .Properties of `datafeed_config`
- [%collapsible%open]
- ====
- `authorization`:::
- (Optional, object)
- The security privileges that the {dfeed} uses to run its queries. If
- {stack-security-features} were disabled at the time of the most recent update to
- the {dfeed}, this property is omitted.
- +
- .Properties of `authorization`
- [%collapsible%open]
- =====
- `api_key`:::
- (object) If an API key was used for the most recent update to the {dfeed}, its
- name and identifier are listed in the response.
- +
- .Properties of `api_key`
- [%collapsible%open]
- ======
- `id`::::
- (string) The identifier for the API key.
- `name`::::
- (string) The name of the API key.
- ======
- `roles`:::
- (array of strings) If a user ID was used for the most recent update to the
- {dfeed}, its roles at the time of the update are listed in the response.
- `service_account`:::
- (string) If a service account was used for the most recent update to the {dfeed},
- the account name is listed in the response.
- =====
- `datafeed_id`:::
- (Optional, string)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=datafeed-id]
- `aggregations`:::
- (Optional, object)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=aggregations]
- `chunking_config`:::
- (Optional, object)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=chunking-config]
- +
- .Properties of `chunking_config`
- [%collapsible%open]
- =====
- `mode`:::
- (string)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=mode]
- `time_span`:::
- (<<time-units,time units>>)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=time-span]
- =====
- `delayed_data_check_config`:::
- (Optional, object)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config]
- +
- .Properties of `delayed_data_check_config`
- [%collapsible%open]
- =====
- `check_window`::
- (<<time-units,time units>>)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-check-window]
- `enabled`::
- (Boolean)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-enabled]
- =====
- `frequency`:::
- (Optional, <<time-units, time units>>)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=frequency]
- `indices`:::
- (Required, array)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices]
- `indices_options`:::
- (Optional, object)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices-options]
- `job_id`:::
- (Required, string)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
- `max_empty_searches`:::
- (Optional,integer)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=max-empty-searches]
- `query`:::
- (Optional, object)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query]
- `query_delay`:::
- (Optional, <<time-units, time units>>)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query-delay]
- `runtime_mappings`:::
- (Optional, object)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=runtime-mappings]
- `script_fields`:::
- (Optional, object)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=script-fields]
- `scroll_size`:::
- (Optional, unsigned integer)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=scroll-size]
- ====
- `finished_time`::
- (string) If the job closed or failed, this is the time the job finished,
- otherwise it is `null`. This property is informational; you cannot change its
- value.
- `job_type`::
- (string) Reserved for future use, currently set to `anomaly_detector`.
- `job_version`::
- (string) The version of {es} that existed on the node when the job was created.
- `model_snapshot_id`::
- (string)
- include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-snapshot-id]
- [[ml-get-job-response-codes]]
- == {api-response-codes-title}
- `404` (Missing resources)::
- If `allow_no_match` is `false`, this code indicates that there are no
- resources that match the request or only partial matches for the request.
- [[ml-get-job-example]]
- == {api-examples-title}
- [source,console]
- --------------------------------------------------
- GET _ml/anomaly_detectors/high_sum_total_sales
- --------------------------------------------------
- // TEST[skip:Kibana sample data]
- The API returns the following results:
- [source,js]
- ----
- {
- "count": 1,
- "jobs": [
- {
- "job_id" : "high_sum_total_sales",
- "job_type" : "anomaly_detector",
- "job_version" : "8.4.0",
- "create_time" : 1655852735889,
- "finished_time" : 1655852745980,
- "model_snapshot_id" : "1575402237",
- "custom_settings" : {
- "created_by" : "ml-module-sample",
- ...
- },
- "datafeed_config" : {
- "datafeed_id" : "datafeed-high_sum_total_sales",
- "job_id" : "high_sum_total_sales",
- "authorization" : {
- "roles" : [
- "superuser"
- ]
- },
- "query_delay" : "93169ms",
- "chunking_config" : {
- "mode" : "auto"
- },
- "indices_options" : {
- "expand_wildcards" : [
- "open"
- ],
- "ignore_unavailable" : false,
- "allow_no_indices" : true,
- "ignore_throttled" : true
- },
- "query" : {
- "bool" : {
- "filter" : [
- {
- "term" : {
- "event.dataset" : "sample_ecommerce"
- }
- }
- ]
- }
- },
- "indices" : [
- "kibana_sample_data_ecommerce"
- ],
- "scroll_size" : 1000,
- "delayed_data_check_config" : {
- "enabled" : true
- }
- },
- "groups" : [
- "kibana_sample_data",
- "kibana_sample_ecommerce"
- ],
- "description" : "Find customers spending an unusually high amount in an hour",
- "analysis_config" : {
- "bucket_span" : "1h",
- "detectors" : [
- {
- "detector_description" : "High total sales",
- "function" : "high_sum",
- "field_name" : "taxful_total_price",
- "over_field_name" : "customer_full_name.keyword",
- "detector_index" : 0
- }
- ],
- "influencers" : [
- "customer_full_name.keyword",
- "category.keyword"
- ],
- "model_prune_window": "30d"
- },
- "analysis_limits" : {
- "model_memory_limit" : "13mb",
- "categorization_examples_limit" : 4
- },
- "data_description" : {
- "time_field" : "order_date",
- "time_format" : "epoch_ms"
- },
- "model_plot_config" : {
- "enabled" : true,
- "annotations_enabled" : true
- },
- "model_snapshot_retention_days" : 10,
- "daily_model_snapshot_retention_after_days" : 1,
- "results_index_name" : "shared",
- "allow_lazy_open" : false
- }
- ]
- }
- ----
|