Skip to content

Commit

Permalink
Add machine learning API examples (#2452)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl authored Apr 4, 2024
1 parent f95a873 commit a564338
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"summary": "A successful response when closing anomaly detection jobs.",
"value": {
"closed": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"summary": "A successful response when deleting an anomaly detection job.",
"value": {
"acknowledged": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"summary": "A successful response when deleting an anomaly detection job asynchronously.",
"description": "When the `wait_for_completion` query parameter is set to `false`, the response contains an identifier for the job deletion task.",
"value": {
"task": "oTUltX4IQMOUUVeiohTt8A:39"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"summary": "A successful response when opening an anomaly detection job.",
"value": {
"opened": true,
"node": "node-1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"summary": "A request to open anomaly detection jobs.",
"description": "The timeout specifies to wait 35 minutes for the job to open.",
"value": {
"timeout": "35m"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"summary": "A successful response when creating an anomaly detection job and datafeed.",
"value": {
"job_id": "test-job1",
"job_type": "anomaly_detector",
"job_version": "8.4.0",
"create_time": 1656087283340,
"datafeed_config": {
"datafeed_id": "datafeed-test-job1",
"job_id": "test-job1",
"authorization": {
"roles": ["superuser"]
},
"query_delay": "61499ms",
"chunking_config": {
"mode": "auto"
},
"indices_options": {
"expand_wildcards": ["open"],
"ignore_unavailable": false,
"allow_no_indices": true,
"ignore_throttled": true
},
"query": {
"bool": {
"must": [
{
"match_all": {}
}
]
}
},
"indices": ["kibana_sample_data_logs"],
"scroll_size": 1000,
"delayed_data_check_config": {
"enabled": true
},
"runtime_mappings": {
"hour_of_day": {
"type": "long",
"script": {
"source": "emit(doc['timestamp'].value.getHour());"
}
}
}
},
"analysis_config": {
"bucket_span": "15m",
"detectors": [
{
"detector_description": "Sum of bytes",
"function": "sum",
"field_name": "bytes",
"detector_index": 0
}
],
"influencers": [],
"model_prune_window": "30d"
},
"analysis_limits": {
"model_memory_limit": "11mb",
"categorization_examples_limit": 4
},
"data_description": {
"time_field": "timestamp",
"time_format": "epoch_ms"
},
"model_plot_config": {
"enabled": true,
"annotations_enabled": true
},
"model_snapshot_retention_days": 10,
"daily_model_snapshot_retention_after_days": 1,
"results_index_name": "custom-test-job1",
"allow_lazy_open": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"summary": "A request to create an anomaly detection job and datafeed.",
"value": {
"analysis_config": {
"bucket_span": "15m",
"detectors": [
{
"detector_description": "Sum of bytes",
"function": "sum",
"field_name": "bytes"
}
]
},
"data_description": {
"time_field": "timestamp",
"time_format": "epoch_ms"
},
"analysis_limits": {
"model_memory_limit": "11MB"
},
"model_plot_config": {
"enabled": true,
"annotations_enabled": true
},
"results_index_name": "test-job1",
"datafeed_config": {
"indices": ["kibana_sample_data_logs"],
"query": {
"bool": {
"must": [
{
"match_all": {}
}
]
}
},
"runtime_mappings": {
"hour_of_day": {
"type": "long",
"script": {
"source": "emit(doc['timestamp'].value.getHour());"
}
}
},
"datafeed_id": "datafeed-test-job1"
}
}
}

0 comments on commit a564338

Please sign in to comment.