I want to include only specific fields in the message body of email action. When using the {{context.hits}} it is returning the whole document. But I want to include only specific fields from the document.
Thanks in advance
I want to include only specific fields in the message body of email action. When using the {{context.hits}} it is returning the whole document. But I want to include only specific fields from the document.
Thanks in advance
I can give you an example:
Let's say in the input part of your watcher you've got that kind of selection:
"input": {
{
"Application": {
"simple": {
"name" : "TEST"
}
}
}
Then in your email body you can just refer to it as {{ctx.payload.Application.name}}
If what you get is a list of elements, let's say a list of name and phone number like this:
testlist.name
testlist.phone
and you want to dispatch all the values, you need to use the following sentences:
{{#ctx.payload.testlist.hits.hits}}{{#_source}}{{name}}{{/_source}}{{/ctx.payload.testlist.hits.hits}}
or you can expand:
{{#ctx.payload.testlist.hits.hits}}{{#_source}} whatever you want {{phone}} and other things like this{{name}} and that's it{{/_source}}{{/ctx.payload.testlist.hits.hits}}
Thank you John
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
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.