I have a colleciton in Elastic Search where we store events, and aggregate these in reports such as:
We'd like to move to DocumentDB, but with no support for GROUPING, I don't see how I could implement this without making 7+24 queries. Any ideas?
Thanks
For information, DocumentDB does now support Aggregates (as of March 8th 2017), for the following operations:
SUM
and AVG
for numeric values, COUNT
, MIN
, and MAX
over numbers, strings, Booleans, and nulls.
Official Microsoft documentation has been updated, and can be found here.
Please note that Grouping support has not been added to Aggregate Functions; a User Voice issue has been opened to request this, and can be upvoted here.
Based on my understanding, you want to move your event data to DocumentDb as a document in a collection. As your said, DocumentDb is not support for aggregate operations now, but the feature will be supported in the future as the offical site said. However, per my experience, you can use the stored procedure of DocumentDb to implement your needs, and automatically count the number of the event documents per the periods as you want to store as a new document of a new collection which for per day/hour via database trigger, please refer to the offical tutorial DocumentDB server-side programming: Stored procedures, database triggers, and UDFs to know it.
Meanwhile, I discovered a SO thread Grouping by a field in DocumentDB which is very helpful for you. The answerer has written a library documentdb-lumenize based on DocumentDb stored procedure that you can try it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With