ruby on rails - Geospatial Searches with Searchkick to find users -


i started use searchkick rails web service, moment testing. want retrieve users around perimeter of location that.

for test have user object (with email, name...), , position object (with longitude, latitude , reference 1 user). , user have has_many relation position.

for moment position

class position < activerecord::base   belongs_to :user   searchkick locations: ["location"]    def search_data     attributes.merge location: [latitude, longitude]   end end 

and try research

position.search *,  where: {location: {near: [50.632049, 3.068322], within: "100mi"}} 

but following error

nested: queryparsingexception[[positions_development_20140310223244065] failed find geo_point field [location]]; }]","status":400} 

i don't know have do. (i'm new rails, , elastic search) if can give me better explanation, take ! thank's

be sure reindex after making changes searchkick or search_data methods.

position.reindex 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -