Skip to content

Instantly share code, notes, and snippets.

@imotov imotov/geo.sh
Last active Aug 29, 2015

Embed
What would you like to do?
curl -XDELETE 'localhost:9200/geotest'
echo
curl -XPOST 'localhost:9200/geotest' -d'{
"settings": {
"number_of_replicas": 0,
"number_of_shards": 1
},
"mappings": {
"doc": {
"properties": {
"name": {
"type": "string"
},
"locationGeo": {
"type": "geo_point",
"lat_lon": true,
"geohash": true
}
}
}
}
}
'
echo
curl -XPOST 'localhost:9200/geotest/doc/1?refresh' -d '{
"name": "foo",
"locationGeo": {
"lat": 32.96179,
"lon": -96.8291685
}
}'
echo
curl 'localhost:9200/geotest/doc/_search?pretty' -d '{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"geo_distance_range": {
"from": "1km",
"to": "40000km",
"locationGeo": {
"lat": 40,
"lon": -70
}
}
}
}
}
}
'
{"error":"IndexMissingException[[geotest] missing]","status":404}
{"ok":true,"acknowledged":true}
{"ok":true,"_index":"geotest","_type":"doc","_id":"1","_version":1}
{
"took" : 187,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "geotest",
"_type" : "doc",
"_id" : "1",
"_score" : 1.0, "_source" : {
"name": "foo",
"locationGeo": {
"lat": 32.96179,
"lon": -96.8291685
}
}
} ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.