Skip to content

Instantly share code, notes, and snippets.

@bugcafe
Created August 8, 2013 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bugcafe/5496e43708839f249dbb to your computer and use it in GitHub Desktop.
Save bugcafe/5496e43708839f249dbb to your computer and use it in GitHub Desktop.
Postcode search
{
"from": 0,
"size": 100,
"fields": ["country",
"country_iso",
"country_name",
"state_abr",
"region1",
"region2",
"region3",
"region4",
"zip",
"city",
"area1",
"area2"],
"script_fields": {
"distance": {
"params": {
"lat": -41.16667,
"lon": 146.35
},
"script": "doc[\u0027location\u0027].distanceInKm(lat,lon)"
}
},
"track_scores": true,
"sort": [{
"_geo_distance": {
"au.location": [146.35,
-41.16667],
"order": "asc",
"unit": "km"
}
}],
"query": {
"query_string": {
"query": "dev",
"fields": ["region1",
"region2",
"region3",
"region4",
"zip",
"city^20"],
"default_operator": "AND"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment