Geo location search


(Renu y-2) #1

Hi,

On querying a document using the geolocation filter, the distance I am
giving in 5km (search in the radius on 5 kms)
However, the results comeback with 10 kms away geopoints too. by trial i
found out that It does not show places which are beyond 22 kms.
However I would like to restrict it to 5 kms.

Whatever could be wrong here?

Query:

curl -X GET "
http://localhost:9200/app_places/_search?from=0&load=true&size=10&pretty=true"
-d '{"query":{"text":{"name_exact":{"query":"cafe coffee
day"}}},"filter":{"geo_distance":{"lat_lon":[28.5190713,77.383332]
,"distance_type":"arc","distance":"5km"}},"size":10,"from":0}'

The response I get is:

{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 3.6822338,
"hits" : [ {
"_index" : "app_places",
"_type" : "place",
"_id" : "504d6e17678474f076979f95",
"_score" : 3.6822338, "_source" : {"name":"Cafe Coffee Day","lat_lon":
[28.60916139,77.383332],"name_phonex":"Cafe Coffee
Day","name_exact":"Cafe Coffee Day","name_partial":"Cafe Coffee Day"}
}, {
"_index" : "app_places",
"_type" : "place",
"_id" : "504d6e17678474f076979f94",
"_score" : 3.6822338, "_source" : {"name":"Cafe Coffee
Day","lat_lon":[28.564116345,77.383332],"name_phonex":"Cafe Coffee
Day","name_exact":"Cafe Coffee Day","name_partial":"Cafe Coffee Day"}
}, {
"_index" : "app_places",
"_type" : "place",
"_id" : "504d6e17678474f076979f92",
"_score" : 3.6822338, "_source" : {"name":"Cafe Coffee
Day","lat_lon":[28.5190713,77.383332],"name_phonex":"Cafe Coffee
Day","name_exact":"Cafe Coffee Day","name_partial":"Cafe Coffee Day"}
} ]
}

--


(Renu y) #2

Changed the distance_type to "plane" and it worked as required.

And I thought "arc" would be more accurate!


(Renu y-2) #3

Changed the distance_type to "plane" and it worked as required.

And I thought "arc" would be more accurate!

On Monday, September 10, 2012 10:13:15 AM UTC+5:30, Renu Y wrote:

Hi,

On querying a document using the geolocation filter, the distance I am
giving in 5km (search in the radius on 5 kms)
However, the results comeback with 10 kms away geopoints too. by trial i
found out that It does not show places which are beyond 22 kms.
However I would like to restrict it to 5 kms.

Whatever could be wrong here?

Query:

curl -X GET "
http://localhost:9200/app_places/_search?from=0&load=true&size=10&pretty=true"
-d '{"query":{"text":{"name_exact":{"query":"cafe coffee
day"}}},"filter":{"geo_distance":{"lat_lon":[28.5190713,77.383332]
,"distance_type":"arc","distance":"5km"}},"size":10,"from":0}'

The response I get is:

{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 3.6822338,
"hits" : [ {
"_index" : "app_places",
"_type" : "place",
"_id" : "504d6e17678474f076979f95",
"_score" : 3.6822338, "_source" : {"name":"Cafe Coffee
Day","lat_lon":[28.60916139,77.383332],"name_phonex":"Cafe Coffee
Day","name_exact":"Cafe Coffee Day","name_partial":"Cafe Coffee Day"}
}, {
"_index" : "app_places",
"_type" : "place",
"_id" : "504d6e17678474f076979f94",
"_score" : 3.6822338, "_source" : {"name":"Cafe Coffee
Day","lat_lon":[28.564116345,77.383332],"name_phonex":"Cafe Coffee
Day","name_exact":"Cafe Coffee Day","name_partial":"Cafe Coffee Day"}
}, {
"_index" : "app_places",
"_type" : "place",
"_id" : "504d6e17678474f076979f92",
"_score" : 3.6822338, "_source" : {"name":"Cafe Coffee
Day","lat_lon":[28.5190713,77.383332],"name_phonex":"Cafe Coffee
Day","name_exact":"Cafe Coffee Day","name_partial":"Cafe Coffee Day"}
} ]
}

--


(system) #4