Created
April 26, 2013 10:09
-
-
Save spinscale/5466258 to your computer and use it in GitHub Desktop.
Geo location reproduction.
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
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