Skip to content

Commit 5aec732

Browse files
committed
Adding aggregation example
1 parent 92a4ffb commit 5aec732

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

queries.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,22 @@
3737
}
3838
}
3939
}'
40+
41+
## Show top 10 senders
42+
43+
### SQL
44+
45+
SELECT sender, COUNT(*) AS num_emails_sent FROM emails GROUP BY sender ORDER BY num_emails_sent DESC LIMIT 10;
46+
47+
### Elasticsearch
48+
49+
curl -XPOST 'http://localhost:9200/enron/_search?pretty' -d '{
50+
"size": 0,
51+
"aggs": {
52+
"top_10_senders": {
53+
"terms": {
54+
"field": "sender"
55+
}
56+
}
57+
}
58+
}'

0 commit comments

Comments
 (0)