Skip to content

Instantly share code, notes, and snippets.

@kimchy
Created June 2, 2011 16:03

Revisions

  1. kimchy created this gist Jun 2, 2011.
    46 changes: 46 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    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
    }
    }
    }
    }
    }
    }'