Skip to content

Commit 987bc7c

Browse files
author
ashwinkumar12345
committed
validation api
1 parent 4bf6f73 commit 987bc7c

File tree

4 files changed

+99
-1
lines changed

4 files changed

+99
-1
lines changed

_monitoring-plugins/ad/api.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,97 @@ Options | Description | Type | Required
332332

333333
---
334334

335+
## Validate detector
336+
Introduced 1.2
337+
{: .label .label-purple }
338+
339+
Returns whether the detector configuration has any issues that might prevent OpenSearch from creating the detector.
340+
341+
You can use the validate API to identify issues in your model configuration before creating the detector.
342+
343+
The request body consists of the detector configuration and follows the same format as the request body of the create detector API:
344+
345+
#### Request
346+
347+
```json
348+
POST _plugins/_anomaly_detection/detectors/_validate
349+
POST _plugins/_anomaly_detection/detectors/_validate/detector
350+
{
351+
"name": "test-detector",
352+
"description": "Test detector",
353+
"time_field": "timestamp",
354+
"indices": [
355+
"server_log*"
356+
],
357+
"feature_attributes": [
358+
{
359+
"feature_name": "test",
360+
"feature_enabled": true,
361+
"aggregation_query": {
362+
"test": {
363+
"sum": {
364+
"field": "value"
365+
}
366+
}
367+
}
368+
}
369+
],
370+
"filter_query": {
371+
"bool": {
372+
"filter": [
373+
{
374+
"range": {
375+
"value": {
376+
"gt": 1
377+
}
378+
}
379+
}
380+
],
381+
"adjust_pure_negative": true,
382+
"boost": 1
383+
}
384+
},
385+
"detection_interval": {
386+
"period": {
387+
"interval": 1,
388+
"unit": "Minutes"
389+
}
390+
},
391+
"window_delay": {
392+
"period": {
393+
"interval": 1,
394+
"unit": "Minutes"
395+
}
396+
}
397+
}
398+
```
399+
400+
If the validate API doesn’t find any issue in the detector configuration, it returns an empty response:
401+
402+
#### Sample response
403+
404+
```json
405+
{}
406+
```
407+
408+
If the validate API finds an issue, it returns a message explaining what's wrong with the configuration. In this example, the feature query is aggregating over a field that doesn’t exist in the data source:
409+
410+
#### Sample response
411+
412+
```json
413+
{
414+
"detector": {
415+
"feature_attributes": {
416+
"message": "Feature has invalid query returning empty aggregated data: average_total_rev",
417+
"sub_issues": {
418+
"average_total_rev": "Feature has invalid query returning empty aggregated data"
419+
}
420+
}
421+
}
422+
}
423+
```
424+
---
425+
335426
## Get detector
336427
Introduced 1.0
337428
{: .label .label-purple }

_monitoring-plugins/ad/index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ We recommend experimenting with historical analysis with different feature sets
110110

111111
## Step 4: Review and create
112112

113-
Review your model configuration and select **Create detector**.
113+
Review your detector settings and model configurations to make sure that they're valid and then proceed to select **Create detector**.
114+
115+
![Anomaly detection results]({{site.url}}{{site.baseurl}}/images/review_ad.png)
116+
117+
If you see any validation errors, edit the settings to fix the errors and then return back to this page.
118+
{: .note }
114119

115120
## Step 5: Observe the results
116121

_security-plugin/access-control/permissions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ These permissions are for the cluster and can't be applied granularly. For examp
8080
- cluster:admin/opendistro/ad/detector/search
8181
- cluster:admin/opendistro/ad/detector/stats
8282
- cluster:admin/opendistro/ad/detector/write
83+
- cluster:admin/opendistro/ad/detector/validate
8384
- cluster:admin/opendistro/ad/detectors/get
8485
- cluster:admin/opendistro/ad/result/search
86+
- cluster:admin/opendistro/ad/result/topAnomalies
8587
- cluster:admin/opendistro/ad/tasks/search
8688
- cluster:admin/opendistro/alerting/alerts/ack (acknowledge)
8789
- cluster:admin/opendistro/alerting/alerts/get

images/review_ad.png

77.7 KB
Loading

0 commit comments

Comments
 (0)