Created
May 29, 2025 16:04
-
-
Save akatche/8accffb68232e95117ffdcec799193ab to your computer and use it in GitHub Desktop.
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
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"function_score": { | |
"functions": [ | |
{ | |
"filter": { | |
"match": { | |
"photo_exists": 1 | |
} | |
}, | |
"weight": 200 | |
}, | |
{ | |
"filter": { | |
"match": { | |
"is_premium": 1 | |
} | |
}, | |
"weight": 0 | |
}, | |
{ | |
"filter": { | |
"match": { | |
"display_price_sort": "1" | |
} | |
}, | |
"weight": 200 | |
}, | |
{ | |
"weight": 250, | |
"gauss": { | |
"location": { | |
"origin": { | |
"lat": 42.42, | |
"lon": -71 | |
}, | |
"offset": "0mi", | |
"scale": "150mi", | |
"decay": 0.5 | |
} | |
} | |
}, | |
{ | |
"linear": { | |
"year": { | |
"origin": 2027, | |
"scale": 1, | |
"decay": 0.5 | |
} | |
}, | |
"weight": 1 | |
}, | |
{ | |
"linear": { | |
"photo_count": { | |
"origin": 100, | |
"scale": 1, | |
"decay": 0.5 | |
} | |
}, | |
"weight": 1 | |
}, | |
{ | |
"gauss": { | |
"engagement_7days_rollup.total_listing_impressions": { | |
"origin": 0, | |
"offset": 0, | |
"scale": 1, | |
"decay": 0.5 | |
} | |
}, | |
"weight": 20 | |
}, | |
{ | |
"filter": { | |
"match": { | |
"is_toppremium": 1 | |
} | |
}, | |
"weight": 10 | |
} | |
], | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"terms": { | |
"make_id": [ | |
"2272274" | |
] | |
} | |
}, | |
{ | |
"terms": { | |
"class_id": [ | |
"198073", | |
"198070", | |
"2440298492", | |
"198067", | |
"198068", | |
"198069", | |
"139350904", | |
"198071", | |
"198074", | |
"198072", | |
"2440298574", | |
"2440298575" | |
] | |
} | |
}, | |
{ | |
"bool": { | |
"should": [ | |
{ | |
"multi_match": { | |
"query": "flight", | |
"fields": [ | |
"category_name.stem^0.5", | |
"city.stem^0.3", | |
"class_name.stem^0.5", | |
"description.stem^1", | |
"engine_manufacturer.stem^0.1", | |
"engine_type.stem^0.1", | |
"fuel_type.stem^0.1", | |
"interior_color.stem^0.1", | |
"keyword.stem^1", | |
"make_name.stem^1", | |
"mfr_serial_num.stem^0.1", | |
"model_name.stem^1", | |
"stock_number.stem^0.1", | |
"trim_name.stem^0.3", | |
"zip_code.stem^0.3" | |
], | |
"fuzziness": "AUTO", | |
"type": "best_fields", | |
"minimum_should_match": "2<-1 3<65%", | |
"prefix_length": 2 | |
} | |
}, | |
{ | |
"multi_match": { | |
"query": "flight", | |
"fields": [ | |
"category_name^5", | |
"city^3", | |
"class_name^5", | |
"description^10", | |
"engine_manufacturer^1", | |
"engine_type^1", | |
"fuel_type^1", | |
"interior_color^1", | |
"keyword^10", | |
"make_name^10", | |
"mfr_serial_num^1", | |
"model_name^10", | |
"stock_number^1", | |
"trim_name^3", | |
"zip_code^3" | |
], | |
"type": "cross_fields", | |
"minimum_should_match": "2<-1 3<65%" | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"geo_distance": { | |
"distance": "150mi", | |
"location": { | |
"lat": 42.42, | |
"lon": -71 | |
} | |
} | |
} | |
], | |
"should": [ | |
{ | |
"multi_match": { | |
"query": "flight", | |
"fields": [ | |
"category_name.stem^4.75", | |
"city.stem^2.85", | |
"class_name.stem^4.75", | |
"description.stem^9.5", | |
"engine_manufacturer.stem^0.95", | |
"engine_type.stem^0.95", | |
"fuel_type.stem^0.95", | |
"interior_color.stem^0.95", | |
"keyword.stem^9.5", | |
"make_name.stem^9.5", | |
"mfr_serial_num.stem^0.95", | |
"model_name.stem^9.5", | |
"stock_number.stem^0.95", | |
"trim_name.stem^2.85", | |
"zip_code.stem^2.85" | |
], | |
"type": "phrase", | |
"boost": 6, | |
"slop": 0 | |
} | |
} | |
], | |
"must_not": [ | |
{ | |
"terms": { | |
"ad_id": [ | |
"5013136379", | |
"5013714283", | |
"5013146067", | |
"5013629890", | |
"5013769154" | |
] | |
} | |
} | |
] | |
} | |
}, | |
"score_mode": "sum" | |
} | |
} | |
] | |
} | |
}, | |
"aggs": { | |
"totals": { | |
"range": { | |
"field": "ad_id", | |
"ranges": [ | |
{ | |
"from": 0 | |
} | |
] | |
} | |
} | |
}, | |
"_source": [ | |
"ad_id" | |
], | |
"size": 395 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment