Nested elastic query

i am a bit new to elastic queries.
i have a requirement like this..i have a field "X" which contains values like a,b,c,d,e.... . and another field "Y" which contains values like r,s,t,u,v (here i know values in Y and that too only 6 types) but in X i don't know how many types of values are there.
i want to write a query which will return me the count of types of Y values for each type of X .
e.g
a: {r:10,s:4,t:6,u:14,v:45}
b: {r:12,s:43,t:60,u:34,v:41}
.......

any help ll be appreciated!!
thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.