Skip to content

Instantly share code, notes, and snippets.

@dboss101
Created February 28, 2018 15:59
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 dboss101/70336066332014ec8980d940209b48fe to your computer and use it in GitHub Desktop.
Save dboss101/70336066332014ec8980d940209b48fe to your computer and use it in GitHub Desktop.
{
"query": {
"has_child": {
"type": "search_item",
"query": {
"function_score": {
"query": {
"bool": {
"filter": {
"bool": {
"must": [{
"term": {
"inactiveVisibility": "ByAll"
}
}, {
"term": {
"status": "Active"
}
}, {
"term": {
"someAtt.status": "Active"
}
}, {
"exists": {
"field": "someAtt.id"
}
}],
"must_not": [{
"term": {
"someAtt.Id": "someId"
}
}]
}
},
"must": [{
"match": {
"title": {
"query": "black",
"boost": 3,
"type": "phrase",
"slop": 1
}
}
}],
"should": [{
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Shoes/Men's Shoes",
"boost": 0.3366422824638068
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Shoes/Women's Shoes",
"boost": 0.5161070515379116
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Computers & Tablets & Networking",
"boost": 1.0621995213995068
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Cookware, Dining & Bar",
"boost": 0.5798629387170531
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Furniture",
"boost": 0.25749786644888
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Fragrance/Unisex Fragrances",
"boost": 0.3113363497250714
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Vitamins & Dietary Supplements",
"boost": 0.7156280824337762
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture",
"boost": 3.1279173860317693
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Salon & Spa",
"boost": 0.40285491539297696
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Cameras & Photography",
"boost": 0.4348011335997682
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty",
"boost": 3.145063452937868
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Salon & Spa/Backwash Units & Shampoo Bowls",
"boost": 0.319084431542408
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Computers & Tablets & Networking/Other Computers & Networking",
"boost": 0.40414032906198505
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Garden & Patio",
"boost": 0.6320762613236142
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Vitamins & Dietary Supplements/Herbs & Botanicals",
"boost": 0.3605736576703233
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Vitamins & Dietary Supplements/Dietary Supplements",
"boost": 0.22243315887957124
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Clothing",
"boost": 0.6199213186526391
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Luggage",
"boost": 0.25633881496485567
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Health Care",
"boost": 0.28339524315667153
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Sporting Goods",
"boost": 0.6767733797740929
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Children's Home & Furniture/Home Decor",
"boost": 0.29571345812485694
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Cameras & Photography/Film Photography",
"boost": 0.279126173325086
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Accessories",
"boost": 0.49594998176598626
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Computers & Tablets & Networking/Other Computers & Networking/Other Computers & Networking",
"boost": 0.40414032906198505
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Fragrance",
"boost": 0.3113363497250714
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Sporting Goods/Camping & Hiking/Storage",
"boost": 0.24715487300214795
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Make-Up",
"boost": 0.32212782298601167
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Food & Drink",
"boost": 0.33766966027772655
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Garden & Patio/Tool Carriers Aprons & Belts",
"boost": 0.25578856802923694
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Watches",
"boost": 0.3030852382052833
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Children's Home & Furniture/Home Decor/Other Home Decor",
"boost": 0.27751935850854675
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Sound & Vision",
"boost": 0.5133203794377041
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Sporting Goods/Camping & Hiking",
"boost": 0.25291442873739123
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Toys & Games",
"boost": 0.5350980434339642
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Face Skin Care",
"boost": 0.34469270416709386
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Shoes",
"boost": 0.8980760140331435
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Body & Bath",
"boost": 0.3369841986091631
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Children's Home & Furniture",
"boost": 0.30864793935381446
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Appliances",
"boost": 0.31169974707898657
}
}
}
}
}]
}
},
"boost": 10,
"boost_mode": "multiply",
"score_mode": "sum",
"functions": [{
"field_value_factor": {
"field": "calculated.itemRank",
"modifier": "sqrt",
"missing": 1
}
}, {
"field_value_factor": {
"field": "someAtt.quantity",
"modifier": "log1p",
"missing": 0
}
}, {
"weight": 1
}]
}
},
"score_mode": "max",
"inner_hits": {
"size": 1,
"sort": [{
"_score": "desc"
}, {
"someAtt.quantity": "desc"
}, {
"someAtt.price": "asc"
}],
"name": "search_results"
}
}
},
"post_filter": {
"has_child": {
"type": "search_item",
"query": {
"function_score": {
"query": {
"bool": {
"filter": {
"bool": {
"must": [{
"term": {
"inactiveVisibility": "ByAll"
}
}, {
"term": {
"status": "Active"
}
}, {
"term": {
"someAtt.status": "Active"
}
}, {
"exists": {
"field": "someAtt.id"
}
}],
"must_not": [{
"term": {
"someAtt.Id": "someId"
}
}]
}
},
"must": [{
"match": {
"title": {
"query": "black",
"boost": 3,
"type": "phrase",
"slop": 1
}
}
}],
"should": [{
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Shoes/Men's Shoes",
"boost": 0.3366422824638068
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Shoes/Women's Shoes",
"boost": 0.5161070515379116
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Computers & Tablets & Networking",
"boost": 1.0621995213995068
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Cookware, Dining & Bar",
"boost": 0.5798629387170531
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Furniture",
"boost": 0.25749786644888
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Fragrance/Unisex Fragrances",
"boost": 0.3113363497250714
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Vitamins & Dietary Supplements",
"boost": 0.7156280824337762
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture",
"boost": 3.1279173860317693
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Salon & Spa",
"boost": 0.40285491539297696
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Cameras & Photography",
"boost": 0.4348011335997682
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty",
"boost": 3.145063452937868
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Salon & Spa/Backwash Units & Shampoo Bowls",
"boost": 0.319084431542408
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Computers & Tablets & Networking/Other Computers & Networking",
"boost": 0.40414032906198505
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Garden & Patio",
"boost": 0.6320762613236142
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Vitamins & Dietary Supplements/Herbs & Botanicals",
"boost": 0.3605736576703233
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Vitamins & Dietary Supplements/Dietary Supplements",
"boost": 0.22243315887957124
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Clothing",
"boost": 0.6199213186526391
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Luggage",
"boost": 0.25633881496485567
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Health Care",
"boost": 0.28339524315667153
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Sporting Goods",
"boost": 0.6767733797740929
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Children's Home & Furniture/Home Decor",
"boost": 0.29571345812485694
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Cameras & Photography/Film Photography",
"boost": 0.279126173325086
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Accessories",
"boost": 0.49594998176598626
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Computers & Tablets & Networking/Other Computers & Networking/Other Computers & Networking",
"boost": 0.40414032906198505
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Fragrance",
"boost": 0.3113363497250714
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Sporting Goods/Camping & Hiking/Storage",
"boost": 0.24715487300214795
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Make-Up",
"boost": 0.32212782298601167
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Food & Drink",
"boost": 0.33766966027772655
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Garden & Patio/Tool Carriers Aprons & Belts",
"boost": 0.25578856802923694
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Watches",
"boost": 0.3030852382052833
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Children's Home & Furniture/Home Decor/Other Home Decor",
"boost": 0.27751935850854675
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Sound & Vision",
"boost": 0.5133203794377041
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Sporting Goods/Camping & Hiking",
"boost": 0.25291442873739123
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Toys & Games",
"boost": 0.5350980434339642
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Face Skin Care",
"boost": 0.34469270416709386
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Shoes",
"boost": 0.8980760140331435
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Health & Beauty/Body & Bath",
"boost": 0.3369841986091631
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Children's Home & Furniture",
"boost": 0.30864793935381446
}
}
}
}
}, {
"nested": {
"path": "category",
"query": {
"term": {
"category.path": {
"value": "Home, Kitchen & Furniture/Appliances",
"boost": 0.31169974707898657
}
}
}
}
}]
}
},
"boost": 10,
"boost_mode": "multiply",
"score_mode": "sum",
"functions": [{
"field_value_factor": {
"field": "calculated.itemRank",
"modifier": "sqrt",
"missing": 1
}
}, {
"field_value_factor": {
"field": "someAtt.quantity",
"modifier": "log1p",
"missing": 0
}
}, {
"weight": 1
}]
}
},
"score_mode": "max",
"inner_hits": {
"size": 1,
"sort": [{
"_score": "desc"
}, {
"someAtt.quantity": "desc"
}, {
"someAtt.price": "asc"
}],
"name": "search_results"
}
}
},
"size": 30,
"from": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment