-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_categories.yml
68 lines (65 loc) · 2.26 KB
/
get_categories.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
requires:
stack: true
serverless: false
---
setup:
- do:
ml.put_job:
job_id: jobs-get-result-categories
body: >
{
"analysis_config" : {
"detectors" :[{"function":"metric","field_name":"responsetime","by_field_name":"airline"}]
},
"data_description" : {
"format":"xcontent",
"time_field":"time"
}
}
- do:
index:
index: .ml-anomalies-jobs-get-result-categories
id: jobs-get-result-categories-1
body: { "job_id": "jobs-get-result-categories", "category_id": 1, "partition_field_name": "p", "partition_field_value": "v1" }
- do:
index:
index: .ml-anomalies-jobs-get-result-categories
id: jobs-get-result-categories-2
body: { "job_id": "jobs-get-result-categories", "category_id": 2, "partition_field_name": "p", "partition_field_value": "v2" }
- do:
index:
index: .ml-anomalies-jobs-get-result-categories
id: jobs-get-result-categories-3
body: { "job_id": "jobs-get-result-categories", "category_id": 3, "partition_field_name": "p", "partition_field_value": "v1" }
- do:
index:
index: .ml-anomalies-unrelated
id: unrelated-1
body: { "job_id": "unrelated", "category_id": 1 }
- do:
indices.refresh:
index: .ml-anomalies-jobs-get-result-categories
---
teardown:
- do:
ml.delete_job:
job_id: jobs-get-result-categories
---
"ml.get_categories":
- do:
ml.get_categories:
job_id: "jobs-get-result-categories"
- match: { count: 3 }
- match: { categories.0.job_id: jobs-get-result-categories }
- match: { categories.0.category_id: 1 }
- match: { categories.0.partition_field_name: p }
- match: { categories.0.partition_field_value: v1 }
- match: { categories.1.job_id: jobs-get-result-categories }
- match: { categories.1.category_id: 2 }
- match: { categories.1.partition_field_name: p }
- match: { categories.1.partition_field_value: v2 }
- match: { categories.2.job_id: jobs-get-result-categories }
- match: { categories.2.category_id: 3 }
- match: { categories.2.partition_field_name: p }
- match: { categories.2.partition_field_value: v1 }