Getting geodistance filter working!

Hello everybody,

I'm new to elatsicasearch I 'm tryning to have geodistance filter working !

I try to follow differnet piece of advises of the following thread:
http://elasticsearch-users.115913.n3.nabble.com/Update-mapping-td3952162.html

But I still can't get it to work correctly

For my test Im' using the Chrome extesion called sense
(that's why my syntax is slightly different than the one with curl)

Anyway... Below you will find my different test,
from the creation of the index, the mapping, the insert, and the different
unsuccesfull search with geodistance filtering i've tried...

I hope some one could help me

Thx by advance

DELETE try
PUT /try
GET /try/_mapping
PUT /try/pins/_mapping
{
"pin": {
"properties": {
"location": {
"type": "geo_point",
"lat_lon": "true"
},
"text": {
"type": "string"
}
}
}
}
PUT /test/pins/1
{
"pin" : {
"location" : {
"lat" : 40.20,
"lon" : -71.44
},
"text" : "a great hostel"
}
}
PUT /test/pins/2
{
"pin" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
},
"text" : "my favorite family restaurant"
}
}

GET _search
{
"query": {
"match_all": {}
}
}

GET _search
{
"query": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "1200km",
"pin.location": {
"lat": 40.15,
"lon": -71.40
}
}
}
}

GET _search
{
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "2000km",
"pin.location": {
"lat": 40.15,
"lon": -70.40
}
}
}
}
}

GET _search
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "2000km",
"pin.location": {
"lat": 40.15,
"lon": -70.40
}
}
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e4a5330b-f4a2-4c4c-8ab5-84baa5dcca41%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Florent,

You probably just want to be careful with your index names, type, mapping,
and actual document. So if you do something like this, it should work:

  1. PUT http://localhost:9200/try

  2. PUT http://localhost:9200/try/pin/_mapping
    {
    "pin": {
    "properties": {
    "location": {
    "type": "geo_point",
    "lat_lon": "true"
    },
    "text": {
    "type": "string"
    }
    }
    }
    }

  3. POST http://localhost:9200/try/pin/1
    {
    "location" : {
    "lat" : 40.20,
    "lon" : -71.44
    },
    "text" : "a great hostel"
    }

  4. GET http://localhost:9200/try/_search
    {
    "query": {
    "match_all": {}
    },
    "filter": {
    "geo_distance": {
    "distance": "1200km",
    "location": {
    "lat": 40.15,
    "lon": -71.4
    }
    }
    }
    }

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/78532d9c-ced0-4627-809e-670e95b00cb3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.