Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anelson-vidscale/5406d0b15b15adb3df47be9d180cbf51 to your computer and use it in GitHub Desktop.
Save anelson-vidscale/5406d0b15b15adb3df47be9d180cbf51 to your computer and use it in GitHub Desktop.
Elasticsearch query
"aggs": {
"by_site": {
"terms": {
"field": "site",
"size": 500
},
"aggs": {
"by_top_hits" : {
"top_hits": {
"size": 1,
"_source": ["site_type"],
"sort": [ { "@timestamp": { "order": "desc" } } ]
}
}
}
}
--------------------------------------------------------------------------------------
Vega
{
"name": "joined",
"source": "alerts",
"transform": [ { "type": "lookup", "from": "site_to_sitetype", "key": "site", "values": ["site_type"], "fields": ["site"], "as": ["site_typer"], "default" : "no-site-type" } ]
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment