Skip to content

Instantly share code, notes, and snippets.

@semyont
Last active May 16, 2017 06:43
Show Gist options
  • Save semyont/4d4f8d085a104d28eb996d0c1d67a1ca to your computer and use it in GitHub Desktop.
Save semyont/4d4f8d085a104d28eb996d0c1d67a1ca to your computer and use it in GitHub Desktop.
elasticsearch collect mode for nested aggregation when top hit size is bigger then fields. then inner aggregations returns unneeded fields to the upper aggregation layer, combining filtering/ match with this will reduce variance in fields
# use un-analyzed fields
{
"aggs" : {
"domain" : {
"terms" : {
"field" : "doc.domain.keyword",
"size" : 4,
"collect_mode" : "breadth_first"
},
"aggs" : {
"ads" : {
"terms" : {
"field" : "doc.ads.keyword",
"size" : 100
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment