Aggregation of fields

  • 29 March 2022
  • 2 replies
  • 50 views

As an application developer, a very common interface to build is filtering user interfaces. There are a few types of aggregation that would be very useful to us!

 

#1 Unique value aggregation

In order to allow for effective filtering, aggregating a field by all its unique values is vital for this, to enable showing the user all possible options for a certain filter.

Generally the amount of results can be limited to perhaps 1000, but having this paginate (or a higher number of 10000) would be even better! This also allows us in many cases to avoid needing expensive ‘substring queries’ on fields, as doing this in the front end on several thousand strings is trivial. 

Not all fields needs this, so if its required to add a `@aggregatable` decorator, then this is fine!

In addition to this, having the amount of each of these values would be useful, to allow us to sort by the most commonly occurring fields.

This is by far the highest priority for our use case!

 

#2 Count aggregation

Second most important is simply being able to identify the max amount of results a query will give us. This can be up to a certain limit (e.g. 10000), afterwards we can simply display `10000+` in the UI. This is also useful for pagination queries! (This might already be solved if pagination queries have a ‘maxPages` section, if so we can just use that!)

 

#3 Number aggregation

Finally, being able to SUM (and maybe MAX/AVG) a number value within a query would be very useful for us! This is a lower priority, but would be great!

 


2 replies

Userlevel 3

@DanielJohnLevings Could it be assumed you are talking purely about the time series data points or are you also thinking about sequences and other entity types?

For our use case, I’d actually love it to be on a `field`.

E.g. In schema service, I create a ‘work order’ schema. It will contain ‘duration in hours’. I’d like to aggregate that field to see e.g. the total amount of hours within a given filter, average hours of the work orders, etc.

Reply