Hello the community, first post for me so please excuse my possible mistakes.
Here is my issue:
I am using the watcher in Elastic v7.13.4.
I am using watcher to send mail to my customers to produce audit report on different sources.
In my first version I was creating a specific watcher per customer. I evolved to one generic watcher that I copy past and change a value as per bellow:
"input": {
"chain": {
"inputs": [
{
"BipBip": {
"simple": {
"name" : "TEST"
}
}
}
]
}
}
I then just have to use {{ctx.payload.BipBip.name}} in the rest of the watcher so each time I get a new customer to adress, I dont have to change the name value in all the watcher.
Now I am going the next step: I have created an index BipBip where I store all the diffrent information for this customer for the watcher, and I want to use the result to populate the values in the watcher. The final goal is having only 1 watcher that will create / delete watchers according an index.
Let's say for the example BipBip index has 2 fields:
name
email
I tried to do that:
"inputs": [
{
"BipBip": {
"simple": {
// We define the Name value from the index we will look the value in
"name" : "TEST"
}
}
},
{
"BipBiplist" : {
"search" : {
"request": {
"search_type": "query_then_fetch",
"indices" : [
"BipBip"
],
"rest_total_hits_as_int": true,
"body": {
// not sure I need that
"size": 10,
// Query on the index
"query": {
"bool": {
"filter": [
{
"match_phrase": {
"name": "{{ctx.payload.BipBip.name}}"
}
}
],
}
}
}
}
}
}
So far so good...but no, it does not work. I properly fetch the data from the index BipBip, but cant figure out to use the reuslt in the rest of the watcher.
I first tried to use {{ctx.payload.BipBiplist.name}} and {{ctx.payload.BipBiplist.email}} in the other filter I have in the chain input, but even if the watcher execution launch no errors, it does not use the values.
I thought then I should use a specific value (I have only one name per customer) so I used {{ctx.payload.BipBiplist.hits.0.fields.name}}...But it fails to.
Any help possible on that matter?