Skip to content

Instantly share code, notes, and snippets.

@milad621
Last active February 3, 2017 01:07
Show Gist options
  • Save milad621/52947dff5ce1c402a3bdef76a0c8bc29 to your computer and use it in GitHub Desktop.
Save milad621/52947dff5ce1c402a3bdef76a0c8bc29 to your computer and use it in GitHub Desktop.
{
"from": 0,
"size": 600,
"timeout": 1000,
"query": {
"filtered": {
"query": {
"bool": {
"must": {
"dis_max": {
"queries": [
{
"function_score": {
"query": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"nested": {
"query": {
"term": {
"customerTaxonomies.subCat2.seoName": "cell-phone-cases"
}
},
"path": "customerTaxonomies"
}
},
{
"nested": {
"query": {
"term": {
"customerTaxonomies.subCat2.seoName": "cables-chargers-and-adapters"
}
},
"path": "customerTaxonomies"
}
}
],
"minimum_should_match": "1"
}
}
]
}
},
"functions": [
{
"script_score": {
"script": "darwin.scoring.plugin.bands.capture",
"lang": "native",
"params": {
"band_name": "band16",
"band_priority": 160000000,
"request_id": "79ff7e5d-0460-44f4-b9ed-d3bacf135749"
}
}
}
],
"boost_mode": "replace"
}
}
]
}
}
}
}
}
},
"aggregations": {
"price_filter_aggregation": {
"filter": {
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"bool": {
"should": [
{
"nested": {
"query": {
"term": {
"customerTaxonomies.subCat2.seoName": "cell-phone-cases"
}
},
"path": "customerTaxonomies"
}
},
{
"nested": {
"query": {
"term": {
"customerTaxonomies.subCat2.seoName": "cables-chargers-and-adapters"
}
},
"path": "customerTaxonomies"
}
}
],
"minimum_should_match": "1"
}
}
]
}
}
]
}
},
"filter": {
"match_all": {}
}
}
}
},
"aggregations": {
"price_nested_aggregation": {
"nested": {
"path": "dealOptions"
},
"aggregations": {
"min_price": {
"min": {
"field": "dealOptions.perUserMinUnitPriceMinor.amount"
}
},
"max_price": {
"max": {
"field": "dealOptions.perUserMinUnitPriceMinor.amount"
}
},
"price_histogram": {
"histogram": {
"field": "dealOptions.perUserMinUnitPriceMinor.amount",
"interval": 500
},
"aggregations": {
"stats": {
"stats": {
"field": "dealOptions.perUserMinUnitPriceMinor.amount"
}
}
}
}
}
}
}
},
"distance_filter_aggregation": {
"filter": {
"and": {
"filters": [
{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"bool": {
"should": [
{
"nested": {
"query": {
"term": {
"customerTaxonomies.subCat2.seoName": "cell-phone-cases"
}
},
"path": "customerTaxonomies"
}
},
{
"nested": {
"query": {
"term": {
"customerTaxonomies.subCat2.seoName": "cables-chargers-and-adapters"
}
},
"path": "customerTaxonomies"
}
}
],
"minimum_should_match": "1"
}
}
]
}
}
]
}
},
"filter": {
"match_all": {}
}
}
}
},
{
"exists": {
"field": "locations.geoPoint"
}
}
]
}
},
"aggregations": {
"min_distance": {
"min": {
"script": "darwin.scoring.plugin.minDistance",
"lang": "native",
"params": {
"user_lat": 28.652849197387695,
"unit": "ft",
"geo_path": "locations.geoPoint",
"user_lon": -81.44265747070312
}
}
},
"max_distance": {
"max": {
"script": "darwin.scoring.plugin.minDistance",
"lang": "native",
"params": {
"user_lat": 28.652849197387695,
"unit": "ft",
"geo_path": "locations.geoPoint",
"user_lon": -81.44265747070312
}
}
},
"distance_histogram": {
"histogram": {
"script": "darwin.scoring.plugin.minDistance",
"lang": "native",
"params": {
"user_lat": 28.652849197387695,
"unit": "ft",
"geo_path": "locations.geoPoint",
"user_lon": -81.44265747070312
},
"interval": 5280
},
"aggregations": {
"stats": {
"stats": {
"script": "darwin.scoring.plugin.minDistance",
"lang": "native",
"params": {
"user_lat": 28.652849197387695,
"unit": "ft",
"geo_path": "locations.geoPoint",
"user_lon": -81.44265747070312
}
}
}
}
}
}
}
}
}
@milad621
Copy link
Author

milad621 commented Feb 3, 2017

{
"took": 106,
"timed_out": false,
"_shards": {
"total": 14,
"successful": 14,
"failed": 0
},
"hits": {
"total": 16792,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment