mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-27 00:27:25 -04:00
332 lines
8.7 KiB
Text
332 lines
8.7 KiB
Text
[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
|
|
}
|
|
]
|
|
}
|
|
----
|