Watchers Actions Send Field Value

How can I send a field value in the watchers' actions (pager duty notifications)?

For example:

This one works and return number of total hits:
"description":"Total Hits # {{ctx.payload.hits.total}}"

But I want to get the field value of the top hit:
something like this, but it doesn't work (instead {{ctx.payload.hits.hits.get(0)._source.fieldname}} just returns empty value):
"description":"Top Hit Field {{ctx.payload.hits.hits.get(0)._source.fieldname}}"

It's supposed to be something like this:

ctx.payload.hits.hits.<index>.fields.<fieldname>

Where index is a numeric value (would be 0 in you case) and the fieldname has to actually be the name of the field that you want to get the top hit from.

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