GROUP_CONCAT in elasticsearch

Viewed 770

I have following query in MySQL,

SELECT service, COUNT(*) as count, MAX(timestamp) as ts, GROUP_CONCAT(id ORDER BY timestamp DESC) as id_list FROM logs GROUP_BY service ORDER BY ts DESC

Can anyone tell me how to write the same query in elasticsearch?

type and service are a string.

Basically, I want to group by a field and get all the ids in the field as an array within the bucket.

0 Answers
Related