Paginate by unique field count

Hi all,

Say I have a Venue and Event entity.

On the search page, I want to show paginated list of Venues and corresponding Events at that venue in 7 days (One to Many).

One simple approach is to do a global search for Events happening in 7 days.. and then do groupby in the backend. However, this makes pagination difficult because I don't want to paginate on the Events but rather their Venue property (because I want to show 20 venues per page)

Ideally, I want to paginate on Event.venueId or Is this possible ?

I have looked into some techniques like aggregation partition, parent/child, but they all seem overly compex or not ideal.

I'm working with Elasticsearch v 6.4.3.



the join datatype sounds like a valid solution to this approach (aka parent/child). However, if you are able to include all the venue information in each event, then you can simply search for events and use field collapsing on the venue id for example.

This data remodelling would remove the need for more than a single query.


Thanks Alex!

Field collapsing did the job!

1 Like

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