Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

fix wrong field name when preview #277

Merged
merged 1 commit into from
Aug 10, 2020

Conversation

ylwu-amzn
Copy link
Contributor

Issue #258

Description of changes:

snakeCase will replace "." with "_", that may make preview not work when the field name contains "."
User reported preview can't work: opendistro-for-elasticsearch/anomaly-detection#192.
User used field name "host.name" in filter query, but snakeCase will transform it into "host_name" which is an invalid field name. So preview function can't get any data.

We need to exclude detector in preview input when convert keys to snake case, and use convertDetectorKeysToSnakeCase to convert detector keys.

Before

screencapture-localhost-5601-app-opendistro-anomaly-detection-kibana-2020-08-08-13_03_50

After

1. metricbeat data with field name "host.name" in filter query

wrong_field_bug

2. NAB data with field name "value" in filter query

screencapture-localhost-5601-app-opendistro-anomaly-detection-kibana-2020-08-08-12_48_24

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Verified

This commit was signed with the committer’s verified signature.
MGatner MGatner
@ylwu-amzn
Copy link
Contributor Author

Unit test passed locally

Test Suites: 1 skipped, 45 passed, 45 of 46 total
Tests:       4 skipped, 200 passed, 204 total
Snapshots:   35 passed, 35 total
Time:        121.848s
Ran all test suites.
✨  Done in 126.08s.

Integration test passed locally

       Spec                                              Tests  Passing  Failing  Pending  Skipped
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  ad/dashboard/ad_dashboard.spec.ts        01:38        6        6        -        -        - │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  ad/detectorList/detector_list.spec.      01:53       10       10        -        -        - │
  │    ts                                                                                          │
  ├────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ ✔  ad/workflow/create_detector.spec.ts      01:06        1        1        -        -        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        04:39       17       17

@ylwu-amzn ylwu-amzn added the bug Something isn't working label Aug 9, 2020
@ohltyler ohltyler linked an issue Aug 10, 2020 that may be closed by this pull request
Copy link
Contributor

@ohltyler ohltyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for fixing.

@ylwu-amzn ylwu-amzn merged commit fbf96db into opendistro-for-elasticsearch:master Aug 10, 2020
yizheliu-amazon pushed a commit that referenced this pull request Aug 28, 2020
snakeCase will replace "." with "_", that may make preview not work when the field name contains "."
If use field name "host.name" in filter query, snakeCase will transform it into "host_name" which is an invalid field name. So preview function can't get any data.

We need to exclude detector in preview input when convert keys to snake case, and use convertDetectorKeysToSnakeCase to convert detector keys.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

filter query in anomaly detector object for preview
3 participants