Hello,
In SQL i can use GROUP BY to limit number of rows in each group like bellow.
Is there any way to do that in ElasticSearch?
Thanks.
Find the first 10 groups of cars, with 2 hits in each group:
SELECT category, city, makemodel
FROM cars
GROUP BY category TOP 2
Results:
========================================================================================
| category | city | makemodel |
| compact | u.s.a./texas/houston | asian/acura/tl |
| compact | u.s.a./florida/tampa | asian/acura/1.6el |
+---------------+---------------------------------+------------------------------------+
| exotic | u.s.a./florida/tampa | european/bentley/azure |
| exotic | u.s.a./california/san francisco | european/bentley/azure |
Find the numbers of cars in different categories:
SELECT category, grouphitscount
FROM cars
GROUP BY category top 1
Results:
+---------------+----------------+
| category | grouphitscount |
+---------------+----------------+
| compact | 4169 |
| exotic | 1902 |
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c1e2d776-e006-430c-82a0-389e3fc6731c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.