Hi there,
I'm looking for a dead simple, step by step explanation of how to get
started with elaticsearch.
What I've done so far:
I went through the examples on the github readme, and created the twitter
items.
curl -XPUT 'http://localhost:9200/twitter/user/kimchy' -d '{ "name" : "Shay
Banon" }'
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '
{
"user": "kimchy",
"postDate": "2009-11-15T13:12:00",
"message": "Trying out Elastic Search, so far so good?"
}'
curl -XPUT 'http://localhost:9200/twitter/tweet/2' -d '
{
"user": "kimchy",
"postDate": "2009-11-15T14:12:12",
"message": "Another tweet, will it be indexed?"
}'
What I want to do:
Add an extra field "location" to the tweets, and make it a geo_point.
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '
{
"user": "kimchy",
"postDate": "2009-11-15T13:12:00",
"message": "Trying out Elastic Search, so far so good?",
"location" : {
"lat" : 41.12,
"lon" : 8.21
}
}'
curl -XPUT 'http://localhost:9200/twitter/tweet/2' -d '
{
"user": "kimchy",
"postDate": "2009-11-15T14:12:12",
"message": "Another tweet, will it be indexed?" ,
"location" : {
"lat" : 50.12,
"lon" : 8.34
}
}'
I tried adding a mapping, but it does not seem to work.
curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}
'
When I try to filter the results, still all tweets are returned, no matter
how close I set the distance in the filter.
{
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"geo_distance" : {
"distance" : "2km",
"tweet.location" : {
"lat" : 30.00,
"lon" : 50.00
}
}
}
}
}
What am I doing wrong? Thanks for your help
Thorsten