Hello,
So I am a little stuck with this one..
Following this example: https://github.com/elastic/examples/blob/master/Alerting/Sample%20Watches/ml_examples/bucket_record_chain_watch.json
I've managed to successfully create a chained input query that uses first result in a terms query like so:
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gt": "{{ctx.payload.first.aggregations.record_results.top_record_hits.hits.hits.0.fields.start.0}}",
"lt": "{{ctx.payload.first.aggregations.record_results.top_record_hits.hits.hits.0.fields.end.0}}"
}
}
},
{
"term": {
"request_IPAddress":"{{ctx.payload.first.aggregations.record_results.top_record_hits.hits.hits.0._source.over_field_value}}"
}
}
]
}
}
I was wondering.. how might I go about unpacking ctx.payload.first.aggregations.record_results.top_record_hits.hits.hits
so that I can find all documents with the _source.over_field_value
rather than just the first result in the array in hits.0
?
I've played around with the mustache syntax to try and get it to look like this for example: "request_IPAddress": ["49.195.126.239","1.128.107.52"]
But being json I am not sure that is possible with mustache..
Really appreciate any advice you can give
Thanks!