Skip to content

Instantly share code, notes, and snippets.

@mxkh
Created March 14, 2017 20:03
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 mxkh/3ef80054e5b0ff0d5b4b2d4f95abdeda to your computer and use it in GitHub Desktop.
Save mxkh/3ef80054e5b0ff0d5b4b2d4f95abdeda to your computer and use it in GitHub Desktop.
{
"query": {
"nested": {
"path": "search_data.string_facets",
"filter": {
"bool": {
"must": [
{
"term": {
"search_data.string_facets.name": "manufacturer"
}
},
{
"terms": {
"search_data.string_facets.value": [
"Gucci"
]
}
}
]
}
}
}
},
"aggs":{
"agg_string_facet":{
"nested":{
"path":"search_data.string_facets"
},
"aggs":{
"facet_name":{
"terms":{
"field":"search_data.string_facets.name"
},
"aggs":{
"facet_value":{
"terms":{
"field":"search_data.string_facets.value"
}
}
}
}
}
}
},
"size":0
}
{
"took": 9,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 867,
"max_score": 0,
"hits": []
},
"aggregations": {
"agg_string_facet": {
"doc_count": 4722,
"facet_name": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "color",
"doc_count": 1574,
"facet_value": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 110,
"buckets": [
{
"key": "черный",
"doc_count": 490
},
{
"key": "синий",
"doc_count": 330
},
{
"key": "белый",
"doc_count": 120
},
{
"key": "красный",
"doc_count": 106
},
{
"key": "коричневый",
"doc_count": 97
},
{
"key": "розовый",
"doc_count": 79
},
{
"key": "бежевый",
"doc_count": 77
},
{
"key": "зеленый",
"doc_count": 62
},
{
"key": "серый",
"doc_count": 62
},
{
"key": "желтый",
"doc_count": 41
}
]
}
},
{
"key": "manufacturer",
"doc_count": 1574,
"facet_value": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "Gucci",
"doc_count": 1574
}
]
}
},
{
"key": "size",
"doc_count": 1574,
"facet_value": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 308,
"buckets": [
{
"key": "U",
"doc_count": 345
},
{
"key": "M",
"doc_count": 229
},
{
"key": "L",
"doc_count": 185
},
{
"key": "S",
"doc_count": 169
},
{
"key": "XL",
"doc_count": 115
},
{
"key": "XS",
"doc_count": 69
},
{
"key": "XXL",
"doc_count": 65
},
{
"key": "36.5",
"doc_count": 31
},
{
"key": "38",
"doc_count": 29
},
{
"key": "38.5",
"doc_count": 29
}
]
}
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment