Skip to content

Commit a564338

Browse files
authored
Add machine learning API examples (#2452)
1 parent f95a873 commit a564338

File tree

7 files changed

+158
-0
lines changed

7 files changed

+158
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"summary": "A successful response when closing anomaly detection jobs.",
3+
"value": {
4+
"closed": true
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"summary": "A successful response when deleting an anomaly detection job.",
3+
"value": {
4+
"acknowledged": true
5+
}
6+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"summary": "A successful response when deleting an anomaly detection job asynchronously.",
3+
"description": "When the `wait_for_completion` query parameter is set to `false`, the response contains an identifier for the job deletion task.",
4+
"value": {
5+
"task": "oTUltX4IQMOUUVeiohTt8A:39"
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"summary": "A successful response when opening an anomaly detection job.",
3+
"value": {
4+
"opened": true,
5+
"node": "node-1"
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"summary": "A request to open anomaly detection jobs.",
3+
"description": "The timeout specifies to wait 35 minutes for the job to open.",
4+
"value": {
5+
"timeout": "35m"
6+
}
7+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"summary": "A successful response when creating an anomaly detection job and datafeed.",
3+
"value": {
4+
"job_id": "test-job1",
5+
"job_type": "anomaly_detector",
6+
"job_version": "8.4.0",
7+
"create_time": 1656087283340,
8+
"datafeed_config": {
9+
"datafeed_id": "datafeed-test-job1",
10+
"job_id": "test-job1",
11+
"authorization": {
12+
"roles": ["superuser"]
13+
},
14+
"query_delay": "61499ms",
15+
"chunking_config": {
16+
"mode": "auto"
17+
},
18+
"indices_options": {
19+
"expand_wildcards": ["open"],
20+
"ignore_unavailable": false,
21+
"allow_no_indices": true,
22+
"ignore_throttled": true
23+
},
24+
"query": {
25+
"bool": {
26+
"must": [
27+
{
28+
"match_all": {}
29+
}
30+
]
31+
}
32+
},
33+
"indices": ["kibana_sample_data_logs"],
34+
"scroll_size": 1000,
35+
"delayed_data_check_config": {
36+
"enabled": true
37+
},
38+
"runtime_mappings": {
39+
"hour_of_day": {
40+
"type": "long",
41+
"script": {
42+
"source": "emit(doc['timestamp'].value.getHour());"
43+
}
44+
}
45+
}
46+
},
47+
"analysis_config": {
48+
"bucket_span": "15m",
49+
"detectors": [
50+
{
51+
"detector_description": "Sum of bytes",
52+
"function": "sum",
53+
"field_name": "bytes",
54+
"detector_index": 0
55+
}
56+
],
57+
"influencers": [],
58+
"model_prune_window": "30d"
59+
},
60+
"analysis_limits": {
61+
"model_memory_limit": "11mb",
62+
"categorization_examples_limit": 4
63+
},
64+
"data_description": {
65+
"time_field": "timestamp",
66+
"time_format": "epoch_ms"
67+
},
68+
"model_plot_config": {
69+
"enabled": true,
70+
"annotations_enabled": true
71+
},
72+
"model_snapshot_retention_days": 10,
73+
"daily_model_snapshot_retention_after_days": 1,
74+
"results_index_name": "custom-test-job1",
75+
"allow_lazy_open": false
76+
}
77+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"summary": "A request to create an anomaly detection job and datafeed.",
3+
"value": {
4+
"analysis_config": {
5+
"bucket_span": "15m",
6+
"detectors": [
7+
{
8+
"detector_description": "Sum of bytes",
9+
"function": "sum",
10+
"field_name": "bytes"
11+
}
12+
]
13+
},
14+
"data_description": {
15+
"time_field": "timestamp",
16+
"time_format": "epoch_ms"
17+
},
18+
"analysis_limits": {
19+
"model_memory_limit": "11MB"
20+
},
21+
"model_plot_config": {
22+
"enabled": true,
23+
"annotations_enabled": true
24+
},
25+
"results_index_name": "test-job1",
26+
"datafeed_config": {
27+
"indices": ["kibana_sample_data_logs"],
28+
"query": {
29+
"bool": {
30+
"must": [
31+
{
32+
"match_all": {}
33+
}
34+
]
35+
}
36+
},
37+
"runtime_mappings": {
38+
"hour_of_day": {
39+
"type": "long",
40+
"script": {
41+
"source": "emit(doc['timestamp'].value.getHour());"
42+
}
43+
}
44+
},
45+
"datafeed_id": "datafeed-test-job1"
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)