Per Document Monitoring

Hello, I have integrated GitLab into my Opensearch and I am trying to create alarms related to GitLab events. I want to push these alarms to the telegram, but values such as “Status” “Branch” are empty.As below
image
I created my alarms with per document monitor.


My message box is as follows

{
    "text": "The following alerts have been triggered:\n{{#ctx.alerts}}\n  Repository: {{#sample_documents}}{{_source.repository.git_http_url}}{{/sample_documents}}\n  Branch: {{#sample_documents}}{{_source.ref}}{{/sample_documents}}\n  Action: {{#sample_documents}}{{_source.object_kind}}{{/sample_documents}}\n  User: {{#sample_documents}}{{_source.user.username}}{{/sample_documents}}\n  Stage: {{#sample_documents}}{{_source.build_stage}}{{/sample_documents}}\n  Status: {{#sample_documents}}{{_source.build_status}}{{/sample_documents}}\n-----------------\n{{/ctx.alerts}}"
}

Any ideas?

@bastus11 Could you share definition of your monitor?

Hello, @pablo I’m sending you the whole edit page.




@pablo I created my alarm as above.I integrated my gitlab events into opensearche using Gitlab Webhook.I want to generate alarms here.The alarm is triggered properly but the message is not pushed to the telegram properly.

@bastus11 I think your painless code should refer to the query result instead.

ctx.results

I have tried the following 4 codes and all have the same output :sob:





Output:
image