用于过滤 top_hits 的弹性搜索查询

Elastic search query for filtering on top_hits

假设,我有一个 table,格式如下:

sdk_index {device_id, serve_count, event_time}

我想做一个弹性搜索查询,它给我的结果是

1. group by device id and take the max(event_time)

2. on the result of 1 check for rows with serve_count > 0 and return the count.

不允许对聚合进行分析。此功能请求已关闭:feature request for reducers