-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_influencers.yml
87 lines (82 loc) · 2.39 KB
/
get_influencers.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
requires:
stack: true
serverless: false
---
setup:
- do:
ml.put_job:
job_id: get-influencers-test
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-get-influencers-test
id: get-influencers-test_1464739200000_1_1
body:
{
"job_id": "get-influencers-test",
"timestamp": "2016-06-01T00:00:00Z",
"influencer_field_name": "foo",
"influencer_field_value": "bar",
"influencer_score": 50.0,
"result_type" : "influencer",
"bucket_span" : 1
}
- do:
index:
index: .ml-anomalies-get-influencers-test
id: get-influencers-test_1464825600000_1_2
body:
{
"job_id": "get-influencers-test",
"timestamp": "2016-06-02T00:00:00Z",
"influencer_field_name": "foo",
"influencer_field_value": "zoo",
"influencer_score": 80.0,
"result_type" : "influencer",
"bucket_span" : 1,
"is_interim": true
}
- do:
index:
index: .ml-anomalies-get-influencers-test
id: get-influencers-test_1464912000000_1_3
body:
{
"job_id": "get-influencers-test",
"timestamp": "2016-06-03T00:00:00Z",
"influencer_field_name": "foo",
"influencer_field_value": "zoo",
"influencer_score": 60.0,
"result_type" : "influencer",
"bucket_span" : 1
}
- do:
indices.refresh:
index: .ml-anomalies-get-influencers-test
---
teardown:
- do:
ml.delete_job:
job_id: get-influencers-test
---
'ml.get_influencers':
- do:
ml.get_influencers:
job_id: "get-influencers-test"
- match: { count: 3 }
- match: { influencers.0.influencer_score: 80 }
- match: { influencers.0.timestamp: 1464825600000 }
- match: { influencers.1.influencer_score: 60 }
- match: { influencers.1.timestamp: 1464912000000 }
- match: { influencers.2.influencer_score: 50 }
- match: { influencers.2.timestamp: 1464739200000 }