Server-side clustering of geopoints using elasticsearch in rails with aggregation -
i have gone through link server-side clustering of geopoints using elasticsearch, , found working.
i have tried following query
curl -x post http://localhost:9200/albums_development_20160125143457272/_search -d '{"query":{"match_all":{}},"size":0,"aggs":{"filtered_cells":{"filter":{"geo_bounding_box":{"location":{"top_left":"-99.11203924894333, -99.1438711977005","bottom_right":"19.432290408268766,19.432797555748234"}}},"aggs":{"cells":{"geohash_grid":{"field":"location","precision":3},"aggs":{"center_lat":{"avg":{"script":"doc['"'"'location'"'"'].lat"}},"center_lon":{"avg":{"script":"doc['"'"'location'"'"'].lon"}}}}}}}}
and got response
{"doc_count"=>18, "cells"=>{"buckets"=>[{"key"=>"t9y2b1pghpv0", "doc_count"=>9, "center_lat"=>{"value"=>9.9816358}, "center_lon"=>{"value"=>76.2998842}}, {"key"=>"wyen20x0dnp1", "doc_count"=>3, "center_lat"=>{"value"=>37.6639976}, "center_lon"=>{"value"=>127.9784585}}, {"key"=>"4qpy7pjgnmet", "doc_count"=>1, "center_lat"=>{"value"=>-55.1123696}, "center_lon"=>{"value"=>-67.711557}}, {"key"=>"u4y008wghdrf", "doc_count"=>1, "center_lat"=>{"value"=>60.472024}, "center_lon"=>{"value"=>8.468946}}, {"key"=>"thrr3squys6w", "doc_count"=>1, "center_lat"=>{"value"=>25.2048493}, "center_lon"=>{"value"=>55.2707828}}, {"key"=>"t9yjxx6bv4c8", "doc_count"=>1, "center_lat"=>{"value"=>10.8505159}, "center_lon"=>{"value"=>76.2710833}}, {"key"=>"t9y0wyjyf5c1", "doc_count"=>1, "center_lat"=>{"value"=>9.9657787}, "center_lon"=>{"value"=>76.2421147}}, {"key"=>"sctqmswdv5zs", "doc_count"=>1, "center_lat"=>{"value"=>9.561345}, "center_lon"=>{"value"=>41.3836629}}]}}
in bucket hash, have details document count , lat, lng combination except document ids.
what should document ids in response?
Comments
Post a Comment