# Parse context\_hits

**URL:** <https://discuss.elastic.co/t/parse-context-hits/321299>\
**Category:** Kibana\
**Created:** [December 15, 2022, 11:46am UTC](https://discuss.elastic.co/t/parse-context-hits/321299 "2022-12-15T11:46:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pablo\_Sagrera\_Garcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pablo_sagrera_garcia/32/113317_2.png) [@Pablo\_Sagrera\_Garcia](https://discuss.elastic.co/u/Pablo_Sagrera_Garcia)\
**Post date:** [December 15, 2022, 11:46am UTC](https://discuss.elastic.co/t/parse-context-hits/321299/1 "2022-12-15T11:46:46Z")

</div>

I've create a rule whose connector is write to index. I wonder if possible to parse context\_hits to create an additional field when hit the rule.

![Screenshot 2022-12-15 at 12.43.15](https://us1.discourse-cdn.com/elastic/original/3X/a/5/a5de27dd59a580fa6cf63109e200f39a816488be.png)

For example I would like to create an additional field called message only containing subfield messages from dictionary {{context\_hits }}

Thanks

---

<div class="post-metadata">

**Author:** ![Pablo\_Sagrera\_Garcia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pablo_sagrera_garcia/32/113317_2.png) [@Pablo\_Sagrera\_Garcia](https://discuss.elastic.co/u/Pablo_Sagrera_Garcia)\
**Post date:** [December 16, 2022, 12:13pm UTC](https://discuss.elastic.co/t/parse-context-hits/321299/2 "2022-12-16T12:13:13Z")

</div>

I spotted how to achieve that.

putting in the document to index the following field:

"host": "{{context.hits.0.\_source.host\_name}}"

---

<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:** [January 13, 2023, 12:14pm UTC](https://discuss.elastic.co/t/parse-context-hits/321299/3 "2023-01-13T12:14:00Z")

</div>

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