opensearch-project / alerting

📟 Get notified when your data meets certain conditions by setting up monitors, alerts, and notifications
https://opensearch.org/docs/latest/monitoring-plugins/alerting/index/
Apache License 2.0
58 stars 99 forks source link

fix for MapperException[the [enabled] parameter can't be updated for the object mapping [metadata.source_to_query_index_mapping] #1431

Closed sbcd90 closed 5 months ago

sbcd90 commented 5 months ago

Issue #, if available:

Description of changes:

when the source_to_query_index_mapping field is upserted without the .opendistro-alerting-config index present, the mapping for it gets corrupted.

"source_to_query_index_mapping": {
  "properties": {
    "ocsf_api_activityXnRAfI0B9Qgmh2Pzq4q4": {
      "type": "text",
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      }
    }
  }
}

the correct mapping for the field is,

"source_to_query_index_mapping": {
  "type": "object",
  "enabled": false
}

this pr ensures that the upsert doesn't happen if the index is not present.

the test case will be removed before merging the pr once pr review is complete.

CheckList:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.