Can elasticsearch do GROUP BY and ORDER BY count?

Let's say I have dictionary application where people come and look up word definitions.

Im trying to visualize top N most popular words during some timeframe.

In SQL I would do it possibly like this:

SELECT word, count(*) as cnt FROM lookups GROUP BY word ORDER BY cnt DESC;

So I plan on dumping data into ES in this format for example:


Is aggregate query like that possible with ES?

You'll want to do a terms aggregation.


Would I be able to set up those terms aggregations in kibana using some off the shelf chart?

Yes. On the x axis settings (assuming a line chart; other kinds of visualizations works similarly), split the buckets, choose terms aggregation and the field you want to group by. You may find helpful.

Fantastic. I was able to launch everything in docker in minutes and get nice visual.
Thank u!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.