Returning Field Data Inside Aggregation Buckets

(ES USER) #1

I have big dilemma. Try as I might I can not find a better solution to my
problem despite my Google foo.

I have a rather large data set that has field values that I need to get the
distinct values for. I can currently do this either by doing a nested
aggregation and processing the output (grossly inefficient and takes a long
time). The other way I can do it is to do just the first level aggregation
and then do a separate query using the value in each "key" that are
returned. Also not the most efficient when you are talking about hundreds
of thousands of unique values.

For the sake of explanation lets say I have a very large data set of
employees. Among the dozen or so other fields there is an EMPLOYEE_ID,

Is there any way to do an aggregation/facet on just to get the distinct
EMPLOYEE_ID's and also just bring back the value of FIRST_NAME & LAST_NAME
as well without all the extra nonsense?


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
To view this discussion on the web visit
For more options, visit

(system) #2