Last active
April 11, 2019 08:08
-
-
Save oguzhaneren/c27f334617fcf53c21a4c60df193100a to your computer and use it in GitHub Desktop.
Elastic queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET campaignproductcontent/_search | |
{ | |
"query": { | |
"bool": { | |
"filter": [ | |
{ | |
"term": { | |
"campaignId": "301997" | |
} | |
}, | |
{ | |
"term": { | |
"listings.isTransferred": true | |
} | |
} | |
] | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET product/_search | |
{ | |
"_source": false, | |
"aggs": { | |
"brand": { | |
"terms": { | |
"field": "brand.id" | |
}, | |
"aggs": { | |
"names": { | |
"top_hits": { | |
"size": 1, | |
"_source": [ | |
"brand.name" | |
] | |
} | |
} | |
} | |
}, | |
"category": { | |
"terms": { | |
"field": "category.id", | |
"size": 10000 | |
}, | |
"aggs": { | |
"names": { | |
"top_hits": { | |
"size": 1, | |
"_source": [ | |
"category.name" | |
] | |
} | |
} | |
} | |
} | |
}, | |
"query": { | |
"bool": { | |
"filter": [ | |
{ | |
"terms": { | |
"id": [ | |
3288097, | |
3807932, | |
4096713, | |
3288345 | |
], | |
"boost": 1 | |
} | |
} | |
], | |
"adjust_pure_negative": true, | |
"boost": 1 | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET product/_search | |
{ | |
"query": { | |
"bool": { | |
"filter": { | |
"script": { | |
"script": { | |
"source": "doc['productContents.productVariants.barcode'].values.size() == 1", | |
"lang": "painless" | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET category-lookup/_search | |
{ | |
"size": 4, | |
"_source": ["id","realId","name","displayName","categoryAttributes.attribute.id" | |
,"categoryAttributes.attribute.name","categoryAttributes.attribute.type","categoryAttributes.attributeValues.id","categoryAttributes.attributeValues.name"], | |
"query": { | |
"match_all": {} | |
}, | |
"sort": { | |
"_script": { | |
"type": "number", | |
"script": { | |
"lang": "painless", | |
"source": "doc['categoryAttributes.required'].values.size()" | |
}, | |
"order": "desc" | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET category-lookup/_search | |
{ | |
"size": 4, | |
"_source": ["id","realId","name","hierarchyPath"], | |
"query": { | |
"match_all": {} | |
}, | |
"sort": { | |
"_script": { | |
"type": "number", | |
"script": { | |
"lang": "painless", | |
"source": "doc['hierarchyPath.keyword'].value.length()" | |
}, | |
"order": "desc" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment