How to create agg bucket over distinct nested objects

(Alex Roytman) #1


Probably the easiest to explain by example:

I have a meeting with collection of participants (nested mapping). Each Participant is an object consisting of a Person and Company. Very often many people from the same company participate.

Ii need to calculate in how many meetings a company has participated counting only once even if there were many participants for the same company in a meeting. Counting alone i could probably achieve with cardinality aggregation over meeting ID but I also need some other stats (sum) that should not double count and even more so I need to sub aggregate by company department

I guess I could preprocess my documents to add participatingCompanies property with distinct companies and work with it but I would really prefer to avoid polluting my source with such extra fields as it is widely used for various searches, analytics and reporting

I would appreciate your advise


(system) #2