2017-04-11 21:52:47 -04:00
|
|
|
//lcawley Verified example output 2017-04-11
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-get-category]]
|
|
|
|
==== Get Categories
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
The get categories API enables you to retrieve information
|
|
|
|
about the categories in the results for a job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
===== Request
|
|
|
|
|
|
|
|
`GET _xpack/ml/anomaly_detectors/<job_id>/results/categories` +
|
|
|
|
|
|
|
|
`GET _xpack/ml/anomaly_detectors/<job_id>/results/categories/<category_id>`
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Description
|
|
|
|
|
2017-04-18 18:13:21 -04:00
|
|
|
You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
|
2017-04-20 11:45:30 -04:00
|
|
|
privileges to use this API. You also need `read` index privilege on the index
|
|
|
|
that stores the results. The `machine_learning_admin` and `machine_learning_user`
|
|
|
|
roles provide these privileges. For more information, see
|
|
|
|
<<security-privileges>> and <<built-in-roles>>.
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Path Parameters
|
|
|
|
|
|
|
|
`job_id`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Identifier for the job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`category_id`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Identifier for the category. If you do not specify this optional parameter,
|
2017-04-18 18:13:21 -04:00
|
|
|
the API returns information about all categories in the job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
===== Request Body
|
|
|
|
|
|
|
|
//TBD: Test these properties, since they didn't work on older build.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`from`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Skips the specified number of categories.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`size`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Specifies the maximum number of categories to obtain.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
===== Results
|
|
|
|
|
|
|
|
The API returns the following information:
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`categories`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(array) An array of category objects. For more information, see
|
2017-04-10 19:14:26 -04:00
|
|
|
<<ml-results-categories,Categories>>.
|
|
|
|
////
|
2017-04-04 18:26:39 -04:00
|
|
|
===== 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)
|
2017-04-10 19:14:26 -04:00
|
|
|
////
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Examples
|
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
The following example gets category information for the `it_ops_new_logs` job:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
GET _xpack/ml/anomaly_detectors/it_ops_new_logs/results/categories
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
|
|
|
In this example, the API returns the following information for each category:
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
2017-04-10 19:14:26 -04:00
|
|
|
"count": 11,
|
|
|
|
"categories": [
|
|
|
|
{
|
|
|
|
"job_id": "it_ops_new_logs",
|
|
|
|
"category_id": 1,
|
|
|
|
"terms": "Actual Transaction Already Voided Reversed hostname
|
|
|
|
dbserver.acme.com physicalhost esxserver1.acme.com vmhost app1.acme.com",
|
|
|
|
"regex": ".*?Actual.+?Transaction.+?Already.+?Voided.+?Reversed.+?hostname.
|
|
|
|
+?dbserver.acme.com.+?physicalhost.+?esxserver1.acme.com.+?vmhost.
|
|
|
|
+?app1.acme.com.*",
|
|
|
|
"max_matching_length": 137,
|
|
|
|
"examples": [
|
|
|
|
"Actual Transaction Already Voided / Reversed;hostname=dbserver.acme.com;
|
|
|
|
physicalhost=esxserver1.acme.com;vmhost=app1.acme.com"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
...
|
2017-04-04 18:26:39 -04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|