Skip to content

Instantly share code, notes, and snippets.

@kimchy
Created June 2, 2011 16:03
Show Gist options
  • Save kimchy/1004704 to your computer and use it in GitHub Desktop.
Save kimchy/1004704 to your computer and use it in GitHub Desktop.
curl -XPUT 'http://localhost:9200/twitter/'
curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '{
"tweet" : {
"properties" : {
"pin": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
}'
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search",
"pin": {
"location": {
"lat": 7.1383,
"lon": 151.5031
}
}
}'
curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "2000km",
"pin.location": {
"lat": 7,
"lon": 151
}
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment