Find parents with most number of children


(Ludwig Magnusson) #1

I have an index where the type evens are mapped to have the parent type
user. I want to find out what users have the most number of event children.
I have basically done this by searching the children using a terms facet
with the term "_parent". This tells me which user id have generated the
most events and how many. The problem is that I want the full user
document, not just the id. Is this possible to do in one query?

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/cf63e0d6-1cbf-4a1f-8dd3-ebb85d946cb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Alexander Reelsen) #2

Hey,

you would execute the facet query first and then execute a query to get all
the documents, as you need the output of the first query as input for the
second.

--Alex

On Fri, Apr 11, 2014 at 11:34 AM, Ludwig Magnusson <
ludwig.magnusson@gmail.com> wrote:

I have an index where the type evens are mapped to have the parent type
user. I want to find out what users have the most number of event children.
I have basically done this by searching the children using a terms facet
with the term "_parent". This tells me which user id have generated the
most events and how many. The problem is that I want the full user
document, not just the id. Is this possible to do in one query?

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/cf63e0d6-1cbf-4a1f-8dd3-ebb85d946cb8%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/cf63e0d6-1cbf-4a1f-8dd3-ebb85d946cb8%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9Bi2W828n3w4jGTs0bqcVMi_gbj6AXZpRvA2mexc%2B80g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3