Skip to content

Instantly share code, notes, and snippets.

Created June 10, 2011 11:20
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 anonymous/2ba2e3d0d50a5e4c777c to your computer and use it in GitHub Desktop.
Save anonymous/2ba2e3d0d50a5e4c777c to your computer and use it in GitHub Desktop.
ElasticSearch 16.2 differs from 16.1 in that this doesn't work any more.
#!/bin/bash
curl -XDELETE http://127.0.0.1:9200/geotest
curl -XPUT http://127.0.0.1:9200/geotest/geo/0 -d '{}'
curl -XPUT http://127.0.0.1:9200/geotest/geo/_mapping -d '{"geo" : {"properties" : {"locations" : {"type" : "geo_point"}}}}'
curl -XDELETE http://127.0.0.1:9200/geotest/geo/0
curl -XPUT http://127.0.0.1:9200/geotest/geo/1 -d '{"locations":[{"lat":10.0,"lon":11.111111},{"lat":20.0,"lon":21.111111}]}'
sleep 1
curl -XGET 'http://127.0.0.1:9200/geotest/geo/_search?pretty=true' -d '{"query":{"match_all":{}},"from":0,"size":20,"facets":{"geotest":{"geo_distance":{"locations":{"lat":30.134191,"lon":18.187612},"ranges":[{"to":100}]}}}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment