Skip to content

Instantly share code, notes, and snippets.

@SeRGei93
Last active February 11, 2024 21:42
Show Gist options
  • Save SeRGei93/b4d441d630771439a23f4f5e53496d18 to your computer and use it in GitHub Desktop.
Save SeRGei93/b4d441d630771439a23f4f5e53496d18 to your computer and use it in GitHub Desktop.
query
{
"query": {
"bool": {
"must": [
{
"terms": {
"active": [
true
]
}
},
{
"terms": {
"canBuy": [
true
]
}
},
{
"terms": {
"sections": [
3233
]
}
}
]
}
},
"post_filter": {
"bool": {
"filter": [
{
"nested": {
"path": "textFacets",
"query": {
"bool": {
"filter": [
{
"term": {
"textFacets.id": {
"value": "obem-vstroennoy-pamyati"
}
}
},
{
"terms": {
"textFacets.value": [
"32-gb",
"128-gb"
]
}
}
]
}
}
}
},
{
"nested": {
"path": "textFacets",
"query": {
"bool": {
"filter": [
{
"term": {
"textFacets.id": {
"value": "brand"
}
}
},
{
"terms": {
"textFacets.value": [
"apple",
"samsung"
]
}
}
]
}
}
}
}
]
}
},
"aggs": {
"agg_brand": {
"nested": {
"path": "textFacets"
},
"aggs": {
"brand_filter": {
"filter": {
"nested": {
"path": "textFacets",
"query": {
"bool": {
"must": [
{
"term": {
"textFacets.id": "obem-vstroennoy-pamyati"
}
},
{
"terms": {
"textFacets.value": [
"256-gb",
"512-gb"
]
}
}
]
}
}
}
},
"aggs": {
"properties": {
"terms": {
"field": "textFacets.id",
"size": 100
},
"aggs": {
"values": {
"terms": {
"field": "textFacets.value",
"size": 100
}
}
}
}
}
}
}
}
}
}
result
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 123,
"relation": "eq"
},
"max_score": 3.0,
"hits": [
{
"_index": "patio_products-202402082334",
"_id": "198711",
"_score": 3.0,
"_source": {
"id": 198711,
"name": "Смартфон Samsung Galaxy A32 4GB/128GB (черный)",
"shortName": "Galaxy A32 SM-A325FZKGCAU 4GB/128GB (черный)",
"code": "748371-smartfon-samsung-galaxy-a32-4gb-128gb-chernyy",
"xmlId": "c381a2de-f929-11ec-bb95-0050560120e8",
"patioCode": "201666",
"active": true,
"canBuy": true,
"sort": 0,
"typeSite": "product",
"url": "/products/748371-smartfon-samsung-galaxy-a32-4gb-128gb-chernyy/",
"sectionId": 3233,
"price": 929.0,
"oldPrice": 899.0,
"discount": -30.0,
"rate": 4.87,
"countReviews": 1335,
"brand": {
"UF_XML_ID": "3a6ea45e-e175-11dd-8151-001f290af50e",
"ID": 4663,
"UF_NAME": "SAMSUNG",
"UF_NAME_FILTER": "samsung",
"UF_RUSSIAN": "",
"UF_IMAGE_ID": 6488892,
"UF_SORT": 100,
"UF_DESCRIPTION": ""
},
"sections": [
3233
],
"images": [
6511355,
6511356,
6511357,
6511358,
6511359,
6511360,
6511361,
6511362,
6511363,
6511364,
6511365,
6511366,
6511367,
6511368,
6511369
],
"manuals": null,
"video": [
"GNVaOJ9HdG8"
],
"properties": null,
"textFacets": [
{
"id": "podderzhka-standartov-svyazi",
"value": [
"edge-2-9g",
"gprs-2-5g",
"gsm-2g",
"hspa-3-5g",
"hspa-plus-3-75g",
"lte-4g",
"umts-3g"
]
},
{
"id": "operacionnaya-sistema",
"value": [
"android"
]
},
{
"id": "format-fizicheskoy-sim-karty",
"value": [
"nano"
]
},
{
"id": "kolichestvo-yader-processora",
"value": [
"8"
]
},
{
"id": "obem-operativnoy-pamyati",
"value": [
"4-gb"
]
},
{
"id": "obem-vstroennoy-pamyati",
"value": [
"128-gb"
]
},
{
"id": "zaschita",
"value": [
"net"
]
},
{
"id": "material-korpusa",
"value": [
"plastik"
]
},
{
"id": "cvet-korpusa",
"value": [
"chernyy"
]
},
{
"id": "tehnologiya-ekrana",
"value": [
"amoled-super-amoled-plus"
]
},
{
"id": "razreshenie-ekrana",
"value": [
"1080x2400"
]
},
{
"id": "razreshenie-dopolnitelnyh-moduley-kamery",
"value": [
"8--plus-5--plus-5"
]
},
{
"id": "razreshenie-osnovnogo-modulya-front-kame",
"value": [
"20"
]
},
{
"id": "wi-fi",
"value": [
"802-11ac"
]
},
{
"id": "bluetooth",
"value": [
"5-0"
]
},
{
"id": "audiovyhod",
"value": [
"jack-3-5-mm"
]
},
{
"id": "razem-podklyucheniya",
"value": [
"usb-type-c"
]
},
{
"id": "brand",
"value": [
"samsung"
]
}
],
"numberFacets": [
{
"id": "reyting",
"value": [
4.87
]
},
{
"id": "price",
"value": 929.0
}
],
"description": "Экран: <b>6.4 \" 1080x2400 пикселей, AMOLED (Super AMOLED Plus) </b><br>Процессор: <b>MediaTek Helio G80 , 8 ядр., 2 ГГц</b><br>Память: <b>ОЗУ 4 ГБ , 128 ГБ </b><br>Формат физической SIM-карты: <b>Nano</b><br>",
"labels": []
}
}
]
},
"aggregations": {
"agg_brand": {
"doc_count": 13034,
"brand_filter": {
"doc_count": 168,
"properties": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "zaschita",
"doc_count": 100,
"values": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "ot-vlagi",
"doc_count": 64
},
{
"key": "ot-pyli",
"doc_count": 60
},
{
"key": "ot-bryzg",
"doc_count": 32
},
{
"key": "net",
"doc_count": 25
},
{
"key": "ustoychivost-k-carapinam",
"doc_count": 25
},
{
"key": "udaroprochnost",
"doc_count": 1
}
]
}
},
{
"key": "podderzhka-karty-pamyati",
"doc_count": 63,
"values": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "microsdxc",
"doc_count": 35
},
{
"key": "microsd",
"doc_count": 33
},
{
"key": "microsdhc",
"doc_count": 29
},
{
"key": "net",
"doc_count": 24
},
{
"key": "nm-card",
"doc_count": 4
}
]
}
},
{
"key": "material-korpusa",
"doc_count": 5,
"values": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "plastik",
"doc_count": 5
}
]
}
}
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment