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 Search top anomalies to SDK using SDKRestClient #379

Closed
2 tasks
Tracked by #5224
dbwiddis opened this issue Jan 29, 2023 · 1 comment
Closed
2 tasks
Tracked by #5224

Migrate Search top anomalies to SDK using SDKRestClient #379

dbwiddis opened this issue Jan 29, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@dbwiddis
Copy link
Member

Is your feature request related to a problem?

Part of opensearch-project/OpenSearch#5224

What solution would you like?

Migrate the Search top anomalies 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:

  • GET _plugins/_anomaly_detection/detectors/<detectorId>/results/_topAnomalies?historical=false
  • GET _plugins/_anomaly_detection/detectors/<detectorId>/results/_topAnomalies?historical=true
@owaiskazi19
Copy link
Member

Historical:

curl -X POST "localhost:9200/_extensions/_ad-extension/detectors/lxkMxYcBs8GyCDhBVHXy/results/_topAnomalies?historical=true&pretty" -H "Content-Type:application/json" --data '{"size":1,"category_field":["process"],"order":"severity","start_time_ms":1681775253000,"end_time_ms":1682596053000}'

Response:

{
  "buckets": [
    {
      "key": {
        "process": "process3"
      },
      "doc_count": 6,
      "max_anomaly_grade": 0.8088288531976634
    },
    {
      "key": {
        "process": "process0"
      },
      "doc_count": 10,
      "max_anomaly_grade": 0.5819850963637767
    },
    {
      "key": {
        "process": "process2"
      },
      "doc_count": 8,
      "max_anomaly_grade": 0.5378144963535091
    }
  ]
}

HCAD:

curl -X GET "localhost:9200/_extensions/_ad-extension/detectors/3ZY_xYcBVyaRNun-bpWE/results/_topAnomalies?historical=false" -H "Content-Type:application/json" --data '{"size":3, "category_field": ["process"],"order":"severity","start_time_ms":1681732053000,"end_time_ms":1682642783000}'

Response:

{
  "buckets": [
    {
      "key": {
        "process": "process0"
      },
      "doc_count": 2,
      "max_anomaly_grade": 0.25124500247214804
    }
  ]
}

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

2 participants