Let i got 4 hits when i run my filter query in my input section of watcher.
And Under action ,i want to send the value of all hits field in the body of my mail box.So How i iterate for loop over my hits in action section of my watcher.
"actions": {
"email_admin": {
"email": {
"to": "'xyz'",
"subject": "{{ctx.watch_id}} executed",
"body": "{{ctx.watch_id}} the full data {{ctx.payload}} extarct field {{ctx.payload.hits.hits.0._source.CardNumber}} hits"
}
}
}
}
here,I am getting only 0 index cardNumber and for rest of other hit, how should i get ?
the number in the mustache template represents the index {{ctx.payload.hits.hits.0._source.CardNumber}}, so you could access other elements by increasing it. However what you really want, is looping through your results...
try this snippet and check your logs if that suits your use-case
I am getting this data from {[ ctx.payload }} .Now i want to send all teh detail of each hit on my mail box using command {{ctx.payload.hits.hits.0._source.CardNumber}} it only give cardnumber of first hit .Question is how should i get the cardnumber for the rest of hits in the same mail .
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.