forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jobs_get_result_influencers.yml
203 lines (180 loc) · 5.97 KB
/
jobs_get_result_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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
setup:
- skip:
features: headers
- do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.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:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
Content-Type: application/json
index:
index: .ml-anomalies-get-influencers-test
type: doc
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:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
Content-Type: application/json
index:
index: .ml-anomalies-get-influencers-test
type: doc
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:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
Content-Type: application/json
index:
index: .ml-anomalies-get-influencers-test
type: doc
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:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh:
index: .ml-anomalies-get-influencers-test
---
"Test result influencers api":
- do:
xpack.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 }
---
"Test get influencers with paging":
- do:
xpack.ml.get_influencers:
job_id: "get-influencers-test"
from: 1
size: 2
- match: { count: 3 }
- length: { influencers: 2 }
- match: { influencers.0.influencer_score: 60 }
- match: { influencers.0.timestamp: 1464912000000 }
- match: { influencers.1.influencer_score: 50 }
- match: { influencers.1.timestamp: 1464739200000 }
---
"Test get influencers with paging in body":
- do:
xpack.ml.get_influencers:
job_id: "get-influencers-test"
body: >
{
"page": {
"from": 1,
"size": 2
}
}
- match: { count: 3 }
- length: { influencers: 2 }
- match: { influencers.0.influencer_score: 60 }
- match: { influencers.0.timestamp: 1464912000000 }
- match: { influencers.1.influencer_score: 50 }
- match: { influencers.1.timestamp: 1464739200000 }
---
"Test get influencers given exclude_interim false":
- do:
xpack.ml.get_influencers:
job_id: "get-influencers-test"
exclude_interim: false
- match: { count: 3 }
---
"Test get influencers given exclude_interim true":
- do:
xpack.ml.get_influencers:
job_id: "get-influencers-test"
exclude_interim: true
- match: { count: 2 }
- match: { influencers.0.timestamp: 1464912000000 }
- match: { influencers.0.is_interim: false }
- match: { influencers.1.timestamp: 1464739200000 }
- match: { influencers.1.is_interim: false }
---
"Test result influencers api with time range":
- do:
xpack.ml.get_influencers:
job_id: "get-influencers-test"
start: "2016-06-01T00:00:00Z"
end: "2016-06-01T01:00:00Z"
- match: { count: 1 }
- match: { influencers.0.timestamp: 1464739200000 }
---
"Test with unknown job id":
- do:
catch: missing
xpack.ml.get_influencers:
job_id: "non-existent-job"
---
"Test get influencers api with influencer score filter":
- do:
xpack.ml.get_influencers:
job_id: "get-influencers-test"
influencer_score: 70
- match: { count: 1 }
- match: { influencers.0.timestamp: 1464825600000 }
---
"Test get influencers api sort":
- do:
xpack.ml.get_influencers:
job_id: "get-influencers-test"
desc: false
- match: { count: 3 }
- match: { influencers.0.influencer_score: 50 }
- match: { influencers.1.influencer_score: 60 }
- match: { influencers.2.influencer_score: 80}
- do:
xpack.ml.get_influencers:
job_id: "get-influencers-test"
sort: timestamp
- match: { count: 3 }
- match: { influencers.0.timestamp: 1464912000000 }
- match: { influencers.1.timestamp: 1464825600000 }
- match: { influencers.2.timestamp: 1464739200000 }