Skip to content

Instantly share code, notes, and snippets.

@spinscale
Created April 26, 2013 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save spinscale/5466258 to your computer and use it in GitHub Desktop.
Save spinscale/5466258 to your computer and use it in GitHub Desktop.
Geo location reproduction.
curl -X PUT localhost:9200/geotest/
curl -X PUT localhost:9200/geotest/geotest/_mapping -d '{
"geotest": {
"properties": {
"location": {
"type": "geo_point",
"lat_lon": true,
"geohash": true
}
}
}
}'
curl -X POST localhost:9200/geotest/geotest -d '{
"name" : "Rue de Barfleur - Charlesbourg",
"location": {
"lon": -71.285605,
"lat": 46.869125
}
}'
curl -X POST localhost:9200/geotest/geotest -d '{
"name" : "48e Rue Ouest - Beauport",
"location": {
"lon": -71.258221,
"lat": 46.843492
}
}'
curl -X POST localhost:9200/geotest/geotest -d '{
"name" : "Rue Racine - La Haute-Saint-Charles",
"location": {
"lon": -71.356247,
"lat": 46.855498
}
}'
curl -X POST localhost:9200/geotest/geotest -d '{
"name" : "Rue whatever - matching nearby",
"location": {
"lon": -71.378453,
"lat": 46.888575
}
}'
curl -X POST localhost:9200/geotest/geotest/_search -d '{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "1km",
"location": {
"lat": 46.884106,
"lon": -71.377042
}
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment