Hi,
I have a lot of DOM instances and I would like to be able to get a unique list of values from one specific field.
As an example, let's say I have DOM instances representing a food order in a restaurant. One of the fields is the waiter that took the order.
Now in this example I would like to get a list of all unique waiters across all orders.
Should I just get all orders and extract the waiters from that or is there a better way to accomplish this, as I don't know what the performance impact will be over time when the number of orders grows.
Hi Wouter I would just create a query that does a group by "Waiter" in your case as this is stored in elastic this should be a quite fast operation
I’m actually doing this in code, and am able to get the unique waiters like this:
DomHelper.DomInstances.Read(filter).DistinctBy(order => order.waiter);
So, to finetune my question, is the DistinctBy doing the select pre or post fetch?
As I would prefer a pre fetch, similar like a ‘distinct’ in eg MySQL querying.
hi Wouter, the DistinctBy will kick in post fetch I’m afraid.
This will indeed get you the correct result, although I don’t believe aggregations are already optimized for DOM instances. This means that aggregating will be done in GQI and it will fetch all instances in the background.