Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Execute Detector to SDK using SDKRestClient #685

Closed
3 tasks done
Tracked by #5224
owaiskazi19 opened this issue Apr 15, 2023 · 1 comment
Closed
3 tasks done
Tracked by #5224

Migrate Execute Detector to SDK using SDKRestClient #685

owaiskazi19 opened this issue Apr 15, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@owaiskazi19
Copy link
Member

owaiskazi19 commented Apr 15, 2023

Is your feature request related to a problem?

We missed adding this API as it's not documented here: https://opensearch.org/docs/latest/observing-your-data/ad/api/#search-detector
Part of opensearch-project/OpenSearch#5224
What solution would you like?

Migrate the Execute Detector Rest API to Extensions SDK using SDKRestClient.

Use the implementation of #353 as a reference. Add new issues for any steps you skip.

Implement the following API endpoints:

  • POST _plugins/_anomaly_detection/detectors/{detector_id}/_run

Tasks:

  • Implement RestExecuteAnomalyDetectorAction
  • Test Api's
@vibrantvarun
Copy link
Member

vibrantvarun commented May 5, 2023

curl -XPOST "localhost:9200/_extensions/_ad-extension-1/detectors/INtM7YcBaIfZEad772kL/_run?pretty" -H "Content-Type:application/json" --data '{"period_start":1683140573000,"period_end":1683440563000,"detector_id":"INtM7YcBaIfZEad772kL","detector":{"name":"test-detector","description":"Test detector","time_field":"@timestamp","indices":["server_log"],"filter_query":{"match_all":{"boost":1.0}},"detection_interval":{"period":{"interval":1,"unit":"Minutes"}},"window_delay":{"period":{"interval":1,"unit":"Minutes"}},"shingle_size":8,"schema_version":0,"feature_attributes":[{"feature_id":"5AxM7YcBd-oyyz7PxEvR","feature_name":"test","feature_enabled":true,"aggregation_query":{"test":{"avg":{"field":"jvmGcTime"}}}}],"last_update_time":1683313454846,"detector_type":"SINGLE_ENTITY"}}}'



{
  "anomalyGrade": 0.0,
  "confidence": 0.9792133299337574,
  "anomalyScore": 0.8974177927602132,
  "error": null,
  "features": [
    {
      "feature_id": "5AxM7YcBd-oyyz7PxEvR",
      "feature_name": "test",
      "data": 109.4872163134643
    }
  ],
  "rcfTotalUpdates": 1434,
  "detectorIntervalInMinutes": 1,
  "relativeIndex": 0,
  "relevantAttribution": [
    0.0
  ],
  "pastValues": null,
  "expectedValuesList": null,
  "likelihoodOfValues": null,
  "threshold": 1.1
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants