Last active
August 29, 2015 14:08
-
-
Save ericuldall/a2e08503b1321b9fcc67 to your computer and use it in GitHub Desktop.
Geo Spatial Curl Recreation
This file contains 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
#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