Skip to content

Instantly share code, notes, and snippets.

@justinkambic
Created July 15, 2019 18:08
Show Gist options
  • Save justinkambic/f0d81ae2941390b4b4eb3bb99382352a to your computer and use it in GitHub Desktop.
Save justinkambic/f0d81ae2941390b4b4eb3bb99382352a to your computer and use it in GitHub Desktop.
GET heartbeat-7*/_search
{
"query": {
"bool": {
"filter": [
{
"exists": {
"field": "summary.up"
}
}
]
}
},
"sort": [
{
"@timestamp": "desc"
}
],
"size": 0,
"aggs": {
"monitors": {
"composite": {
"size": 1000,
"sources": [
{
"monitor_id": {
"terms": {
"field": "monitor.id"
}
}
}
]
},
"aggs": {
"top": {
"top_hits": {
"sort": [
{
"@timestamp": "desc"
}
],
"_source": {
"includes": [
"monitor.check_group",
"@timestamp",
"agent.id"
]
},
"size": 10
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment