As a further simplification, I think the last query can be even reduced to:
q.Paginate(
q.Join(
q.Match(q.Index("offers_by_country"), q.Casefold("croatia")),
q.Index("offers_all_values_by_ref")
)
)
But I’m still stuck with getting a single offer
per uid
I also tried to approach with the tools @databrecht has given in this answer . But no luck, at least for me