alerting-dashboards-plugin icon indicating copy to clipboard operation
alerting-dashboards-plugin copied to clipboard

[BUG] Alerting Dashboard doesn't find sub-fields when building the list of fields by type

Open mjsell1234 opened this issue 2 years ago • 5 comments
trafficstars

What is the bug? The alerting plugin needs to find fields (by type) to offer the visual editor for monitors. The code for recursing over the index mappings to find these fields currently only recurses into "object" types - but any type can have sub-fields within them. The default OS dynamic mapper maps strings to text fields with a keyword sub-field. The current alerting plugin can't find these keyword sub-fields and thus it is impossible to create a per-bucket monitor using the visual editor for such fields (the group-by drop down list is empty in my case).

Relevant code: https://github.com/opensearch-project/alerting-dashboards-plugin/blob/main/public/pages/CreateMonitor/containers/DefineMonitor/utils/mappings.js#L24-L33

How can one reproduce the bug? Steps to reproduce the behavior:

  1. Attempt to create a bucket monitor against an index with mappings like:
{
  "random_index": {
    "mappings": {
        "description": {
          "type": "text",
          "fields": {
            "kwsubfield": {
              "type": "keyword"
            }
          }
        }
      }
    }
  }
}
  1. Observe that the description.kwsubfield is absent from the group-by drop down menu.

What is the expected behavior? The sub-field should be found and listed as a keyword field so that the visual editor works as expected

What is your host/environment?

  • OS: n/a
  • Version n/a
  • Plugins n/a

Do you have any screenshots? If applicable, add screenshots to help explain your problem.

Do you have any additional context? We are encountering this while running OpenSearch Service in AWS, but is definitely not specific to any particular environment.

mjsell1234 avatar Apr 06 '23 19:04 mjsell1234

Just added the simple 1-line fix for this issue - https://github.com/opensearch-project/alerting-dashboards-plugin/pull/518

mjsell1234 avatar Apr 06 '23 19:04 mjsell1234

cc: @AWSHurneyt to help identify the gaps and see if we can plan this for our next release.

getsaurabh02 avatar Jun 01 '23 16:06 getsaurabh02

Any update on this @getsaurabh02 ?

Thanks

mjsell1234 avatar Jun 13 '23 14:06 mjsell1234

Hi @mjsell1234, Thank you for implementing this change! I've commented in the PR you have opened.

AWSHurneyt avatar Jun 14 '23 01:06 AWSHurneyt

As an update, I believe I've found the issue; manual testing suggests the bug is resolved. I'm running through some use cases locally, and working on adding unit tests; and I should have a PR out shortly.

AWSHurneyt avatar Jun 14 '23 18:06 AWSHurneyt