Instantly share code, notes, and snippets.

Embed
What would you like to do?
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