Created
March 18, 2015 05:58
-
-
Save woahdae/fe3d1a3562a463aea4b5 to your computer and use it in GitHub Desktop.
Revisions
-
woahdae created this gist
Mar 18, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,678 @@ { "from": 0, "size": 10, "sort": [ { "_score": { "order": "desc" }, "boost": { "order": "desc", "missing": "_last", "ignore_unmapped": true } } ], "query": { "bool": { "must": [ { "function_score": { "query": { "filtered": { "query": { "match_all": { } }, "filter": { "and": [ { "match_all": { } } ] } } }, "functions": [ { "script_score": { "script_id": "fauxNormalizeInventoryItems" } } ] } }, { "dis_max": { "queries": [ { "function_score": { "score_mode": "max", "query": { "filtered": { "query": { "match_all": { } }, "filter": { "and": [ { "term": { "_type": "organization" } }, { "geo_bounding_box": { "organization.locations.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] } } }, "functions": [ { "filter": { "geo_distance_range": { "from": "0mi", "to": "5mi", "locations.coordinates": [ -121.9885719, 37.5482697 ] } }, "script_score": { "script_id": "echo", "params": { "value": 3 } } }, { "filter": { "geo_distance_range": { "from": "5mi", "to": "10mi", "locations.coordinates": [ -121.9885719, 37.5482697 ] } }, "script_score": { "script_id": "echo", "params": { "value": 2 } } }, { "filter": { "geo_distance_range": { "from": "10mi", "to": "30mi", "locations.coordinates": [ -121.9885719, 37.5482697 ] } }, "script_score": { "script_id": "echo", "params": { "value": 1 } } } ] } } ] } } ] } }, "filter": { "bool": { "should": [ { "and": [ { "match_all": { } }, { "nested": { "path": "schedules", "filter": { "and": [ { "match_all": { } } ] } } } ] }, { "and": [ { "match_all": { } } ] } ] } }, "facets": { "tags": { "terms": { "field": "tags.exact", "size": 15 }, "facet_filter": { "or": [ { "term": { "_type": "inventory_item" } }, { "term": { "_type": "organization" } } ] } }, "type": { "terms": { "field": "_type" } }, "selected_sessions": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "terms": { "script": "doc[\"schedules.id\"].value + \"\n\" +doc[\"schedules.location.coordinates\"].lat + \"\n\" + doc[\"schedules.location.coordinates\"].lon + \"\n\" + doc[\"schedules.location.id\"].value", "size": 5000 } }, "discounts": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "terms": { "field": "schedules.discount.active" } }, "locations": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "terms": { "size": 10, "field": "schedules.location.locality_hierarchy.exact" } }, "days_of_week": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "terms": { "field": "schedules.days_of_week_array" } }, "dow_clustering": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "terms": { "field": "schedules.day_clustering" } }, "time_of_day": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "terms": { "field": "schedules.time_of_day" } }, "ages": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "terms": { "field": "schedules.ages_array", "size": 20 } }, "cost": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "range": { "field": "schedules.cost", "ranges": [ { "to": 50 }, { "from": 50, "to": 100 }, { "from": 100, "to": 250 }, { "from": 250 } ] } }, "this_weekend": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "filter": { "and": [ { "range": { "schedules.starts_on": { "gte": "2015-03-21", "lte": "2015-03-22" } } }, { "range": { "schedules.ends_on": { "gte": "2015-03-21", "lte": "2015-03-22" } } } ] } }, "next_weekend": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "filter": { "and": [ { "range": { "schedules.starts_on": { "gte": "2015-03-28", "lte": "2015-03-29" } } }, { "range": { "schedules.ends_on": { "gte": "2015-03-28", "lte": "2015-03-29" } } } ] } }, "this_month": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "filter": { "and": [ { "range": { "schedules.starts_on": { "gte": "2015-03-18", "lte": "2015-04-01" } } }, { "range": { "schedules.ends_on": { "gte": "2015-03-18", "lte": "2015-04-01" } } } ] } }, "next_month": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "filter": { "and": [ { "range": { "schedules.starts_on": { "gte": "2015-04-01", "lte": "2015-05-01" } } }, { "range": { "schedules.ends_on": { "gte": "2015-04-01", "lte": "2015-05-01" } } } ] } }, "this_summer": { "nested": "schedules", "facet_filter": { "and": [ { "match_all": { } }, { "geo_bounding_box": { "schedules.location.coordinates": { "top_left": { "lat": 37.81892251706024, "lon": -122.36382430479199 }, "bottom_right": { "lat": 37.23999538461684, "lon": -121.63381452064644 } } } } ] }, "filter": { "and": [ { "range": { "schedules.starts_on": { "gte": "2015-06-21", "lte": "2015-09-22" } } }, { "range": { "schedules.ends_on": { "gte": "2015-06-21", "lte": "2015-09-22" } } } ] } } }, "explain": true }