Skip to content

Instantly share code, notes, and snippets.

@ericuldall
Last active August 29, 2015 14:08
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 ericuldall/a2e08503b1321b9fcc67 to your computer and use it in GitHub Desktop.
Save ericuldall/a2e08503b1321b9fcc67 to your computer and use it in GitHub Desktop.
Geo Spatial Curl Recreation
#CREATE INDEX WITH MAPPING
curl -XPOST localhost:9200/things -d '{
"settings": {
"number_of_shards": 1
},
"mappings": {
"thing": {
"properties": {
"pin.location": {"type" : "geo_point"}
}
}
}}';
#ADD A TEST DOC
curl -XPOST localhost:9200/things/thing/_bulk -d '{"index": {"_id": "1234"}
{"name": "my thing", "pin": {"location": {"lat": 35.083175, "lon": -77.083419}}}'
#DO SEARCH
curl localhost:9200/things/thing/_search
{
"query" : {
"match_all" : {}
},
"filter" : {
"geo_distance" : {
"distance" : "200mi",
"pin.location" : {
"lat" : 35.083175,
"lon" : -77.083419
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment