SELECT t.nom, t.latitude, l.longitude, r.MaxTime
FROM (
SELECT name, MAX(time) as MaxTime
FROM BusTable
GROUP BY name ) r
INNER JOIN BusTable t
ON t.name = r.name AND t.time = r.MaxTime
Is it possible to do it with only one elasticsearch query (with agregates) ?
Thank you for you response
F.M.
@fmisso
I top_hits can take you close to what you are looking for. Especially if there is only one entry for MaxTime for each name, you can use following query. You can adjust size inside top_hits to get more matches per name and do client side filtering.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.