mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-30 02:13:33 -04:00
* [ML] adding for_export flag for ml plugin GET resource APIs (#63092) This adds the new `for_export` flag to the following APIs: - GET _ml/anomaly_detection/<job_id> - GET _ml/datafeeds/<datafeed_id> - GET _ml/data_frame/analytics/<analytics_id> The flag is designed for cloning or exporting configuration objects to later be put into the same cluster or a separate cluster. The following fields are not returned in the objects: - any field that is not user settable (e.g. version, create_time) - any field that is a calculated default value (e.g. datafeed chunking_config) - any field that would effectively require changing to be of use (e.g. datafeed job_id) - any field that is automatically set via another Elastic stack process (e.g. anomaly job custom_settings.created_by) closes https://github.com/elastic/elasticsearch/issues/63055 * [ML] adding new flag exclude_generated that removes generated fields in GET config APIs (#63899) When exporting and cloning ml configurations in a cluster it can be frustrating to remove all the fields that were generated by the plugin. Especially as the number of these fields change from version to version. This flag, exclude_generated, allows the GET config APIs to return configurations with these generated fields removed. APIs supporting this flag: - GET _ml/anomaly_detection/<job_id> - GET _ml/datafeeds/<datafeed_id> - GET _ml/data_frame/analytics/<analytics_id> The following fields are not returned in the objects: - any field that is not user settable (e.g. version, create_time) - any field that is a calculated default value (e.g. datafeed chunking_config) - any field that is automatically set via another Elastic stack process (e.g. anomaly job custom_settings.created_by) relates to #63055
154 lines
4.2 KiB
Text
154 lines
4.2 KiB
Text
[role="xpack"]
|
|
[testenv="platinum"]
|
|
[[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}
|
|
|
|
* If the {es} {security-features} are enabled, you must have `monitor_ml`,
|
|
`monitor`, `manage_ml`, or `manage` cluster privileges to use this API. See
|
|
<<security-privileges>> and {ml-docs-setup-privileges}.
|
|
|
|
[[ml-get-job-desc]]
|
|
== {api-description-title}
|
|
|
|
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_id>`, or by omitting the `<job_id>`.
|
|
|
|
IMPORTANT: This API returns a maximum of 10,000 jobs.
|
|
|
|
[[ml-get-job-path-parms]]
|
|
== {api-path-parms-title}
|
|
|
|
`<job_id>`::
|
|
(Optional, string)
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-default]
|
|
|
|
[[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-jobs]
|
|
|
|
`exclude_generated`::
|
|
(Optional, boolean)
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-generated]
|
|
|
|
[[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>>.
|
|
|
|
`create_time`::
|
|
(string) The time the job was created. For example, `1491007356077`. This
|
|
property is informational; you cannot change its value.
|
|
|
|
`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=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" : "7.5.0",
|
|
"groups" : [
|
|
"kibana_sample_data",
|
|
"kibana_sample_ecommerce"
|
|
],
|
|
"description" : "Find customers spending an unusually high amount in an hour",
|
|
"create_time" : 1577221534700,
|
|
"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"
|
|
]
|
|
},
|
|
"analysis_limits" : {
|
|
"model_memory_limit" : "10mb",
|
|
"categorization_examples_limit" : 4
|
|
},
|
|
"data_description" : {
|
|
"time_field" : "order_date",
|
|
"time_format" : "epoch_ms"
|
|
},
|
|
"model_plot_config" : {
|
|
"enabled" : true
|
|
},
|
|
"model_snapshot_retention_days" : 10,
|
|
"daily_model_snapshot_retention_after_days" : 1,
|
|
"custom_settings" : {
|
|
"created_by" : "ml-module-sample",
|
|
...
|
|
},
|
|
"model_snapshot_id" : "1575402237",
|
|
"results_index_name" : "shared",
|
|
"allow_lazy_open" : false
|
|
}
|
|
]
|
|
}
|
|
----
|