Skip to content

Instantly share code, notes, and snippets.

@luiscastillocr
Created March 28, 2016 17:19
Show Gist options
  • Save luiscastillocr/2cba171b4e27d847de90 to your computer and use it in GitHub Desktop.
Save luiscastillocr/2cba171b4e27d847de90 to your computer and use it in GitHub Desktop.
{
'fields':[
'_source'
],
'query':{
'filtered':{
'filter':{
'bool':{
'must':[
{
'geo_distance':{
'location':{
'lat':41.240742,
'lon':-87.64473
},
'distance':'25mi',
'unit':'mi'
}
},
{
'term':{
'is_featured':False
}
},
{
'term':{
'author.id':686
}
}
]
}
}
}
},
'script_fields':{
'distance':{
'params':{
'lat':41.240742,
'lon':-87.64473
},
'script':"doc['location'].distanceInMiles(lat,lon)"
}
},
'sort':[
{
'_geo_distance':{
'distance_type':'plane',
'order':'asc',
'location':{
'lat':41.240742,
'lon':-87.64473
},
'unit':'mi'
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment