# How to use {{#context.hits}} alert with an INDEX action?

**URL:** <https://discuss.elastic.co/t/how-to-use-context-hits-alert-with-an-index-action/345378>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [October 19, 2023, 10:37am UTC](https://discuss.elastic.co/t/how-to-use-context-hits-alert-with-an-index-action/345378 "2023-10-19T10:37:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesarbrown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jamesarbrown/32/126690_2.png) [@jamesarbrown](https://discuss.elastic.co/u/jamesarbrown)\
**Post date:** [October 19, 2023, 10:37am UTC](https://discuss.elastic.co/t/how-to-use-context-hits-alert-with-an-index-action/345378/1 "2023-10-19T10:37:09Z")

</div>

Hi,

I would like to pass the context.hits information to the index alert connector i have created.

The connector all works, but anything re the context.hits and I get an empty result.

This is one of the many itterations I have tried.

```auto
{
  "application": "smartd",
  "severity": "error",
  "errordescription": "triggering data was: {{#context.hits}} - {{_source.host.name}} {{/context.hits}}",
  "@timestamp": "{{context.timestamp}}"
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 16, 2023, 10:37am UTC](https://discuss.elastic.co/t/how-to-use-context-hits-alert-with-an-index-action/345378/2 "2023-11-16T10:37:22Z")

</div>

Closed on November 16, 2023, 10:37am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
