Skip to content

Instantly share code, notes, and snippets.

@sbeckeriv
Created May 30, 2011 02:55
Show Gist options
  • Save sbeckeriv/998396 to your computer and use it in GitHub Desktop.
Save sbeckeriv/998396 to your computer and use it in GitHub Desktop.
ES
"person" => {
"date_formats" => ["yyyy-MM-dd", "dd-MM-yyyy"],
"_all" => {"enabled" => true},
"properties" => {
"_id" => {"index"=> "not_analyzed", "store" => "yes",:type=>'integer'},
"username" => {"type" => "string", "store" => "yes"},
"name" => {"type" => "string", "store" => "yes"},
"location" => {
"type" => "geo_point"
},
"email" => {"type" => "string"},
"company" => {"type" => "string"},
"followers" => {"type" => "integer"},
"following" => {"type" => "integer"},
"started_at"=>{"type" => "date"},
"repos" => {
"properties" => {
"_id" => {"index"=> "not_analyzed", "store" => "yes",:type=>'integer'},
"name" => {"type" => "string"},
"language" => {"type" => "string"}
}
}
}
}
#fine all people near seattle
{
"query": {
"filtered": {
"filter": {
"geo_distance": {
"distance": "12km",
"location": {
"lat": 47.6062095,
"lon": -122.3320708
}
}
},
"query": {
"query_string": {
"query": "name:*"
}
}
}
}
}
#results
{"took":192,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
I know i have people near the lat,lon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment