Skip to content

Instantly share code, notes, and snippets.

@dieterve
Last active October 9, 2018 13:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dieterve/175e5023d84f8404dac2 to your computer and use it in GitHub Desktop.
Save dieterve/175e5023d84f8404dac2 to your computer and use it in GitHub Desktop.
Faceted search with globally filtered aggregations
{
"took": 153,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 0,
"hits": ["..."]
},
"aggregations": {
"all_products": {
"doc_count": 21,
"filterted categories": {
"doc_count": 13,
"categories": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "movies",
"doc_count": 6
},
{
"key": "music",
"doc_count": 4
},
{
"key": "books",
"doc_count": 3
}
]
}
},
"filtered_countries": {
"doc_count": 15,
"countries": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "fr",
"doc_count": 6
},
{
"key": "br",
"doc_count": 4
},
{
"key": "be",
"doc_count": 3
},
{
"key": "pt",
"doc_count": 2
}
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment