Skip to content

Instantly share code, notes, and snippets.

@jacobrose
Last active March 10, 2016 15:36
Show Gist options
  • Save jacobrose/44da297adecef0bb3a75 to your computer and use it in GitHub Desktop.
Save jacobrose/44da297adecef0bb3a75 to your computer and use it in GitHub Desktop.
Boosted geonames/distance query centered at Rhinelander, Wis.
{
"fields": [
"location"
],
"query": {
"function_score": {
"functions": [
{
"exp": {
"location": {
"origin": {
"lat": 45.6394,
"lon": -89.4122
},
"offset": "10mi",
"scale": "120mi"
}
},
"weight": 1
}
],
"query": {
"bool": {
"must": [
{
"term": {
"industry": "apparel_textile"
}
}
],
"should": [
{
"match": {
"capability": {
"boost": 10000,
"query": 233
}
}
},
{
"match": {
"capability": {
"boost": 10000,
"query": 235
}
}
},
{
"match": {
"capability": {
"boost": 10000,
"query": 267
}
}
},
{
"match": {
"geonameid": {
"boost": -10000,
"query": 5268720
}
}
},
{
"match": {
"geonameid": {
"boost": -10000,
"query": 5279468
}
}
},
{
"match": {
"geonameid": {
"boost": 3,
"query": 6252001
}
}
}
],
"must_not": [
{
"term": {
"state": "draft"
}
}
]
}
},
"boost_mode": "sum"
}
},
"sort": {
"_score": "desc",
"profile_quality_score_1": "desc",
"_geo_distance": {
"location": {
"lat": 45.6394,
"lon": -89.4122
},
"order": "asc",
"unit": "mi",
"distance_type": "plane"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment