U
U
un1t2016-05-10 18:38:01
elasticsearch
un1t, 2016-05-10 18:38:01

How to group data by geo-coordinates in Elasticsearch and get _source in each area?

Elasticsearch allows you to group data by area using GeoHash grid Aggregation
But I still need to get one document from each area. (Similar to MySQL's GROUP BY.)
How can I do this without having to query each area?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Polushkin, 2016-09-08
@un1t

Use top_hits inside the aggregation:
https://www.elastic.co/guide/en/elasticsearch/refe...
`sort` specifies a parameter that will serve as the calculation of max and document selection.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question