Multi-field collapsing

I have a use case which requires collapsing on multiple fields.

As a simple example assume I have some movie documents indexed with the
fields: Director, Actor, Title & Release Date. I want to be able to
collapse on Director and Actor, getting the most recent movie (as indicated
by Release Date).

I think the new top hits aggregation almost gets me mostly what I need. I
can create a terms aggregation on Director, with a sub terms aggregation on
Actor, and add a top hits aggregation to that (size 1). Would this be the
proper approach? By traversing over the aggregations I can get all of the
hits that I want - however I can't (have elasticsearch) sort or page them.

It's almost like I'd need a "hitCollector" aggregation which would collect
all search hits generated by it's sub aggregations and allow me to specify
sort and paging information at that level. Thoughts?

Brian

--
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/318b7474-004f-4244-90e8-d9b93639481f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

1 Like