Filter queries are the right thing to use here. It allows the filters to cache separately from the query and will provide, possibly dramatic, performance improvements. Don't worry about the caching concern - you'll have far fewer caches when the filter constraints are separate from the user query.
Erik > On Nov 10, 2014, at 05:01, Bram Van Dam <bram.van...@intix.eu> wrote: > > Hi folks, > > I have an index with hundreds of millions of documents, which users can query > in various ways. > > Two index fields are used by the system to hide certain documents from > certain users (for instance: Department A can only view documents belonging > to Department A, but not Department B). > > We're currently doing something like this: > > query = userQuery AND department:userDepartment > > I'm wondering if perhaps a filter query might be a better fit? > > query = userQuery > filterQuery = department:userDepartment > > This feels a lot cleaner, but I'm worried about the performance implications. > Some users have access to all documents, which might be a bit painful for the > filter cache? Or am I missing something? > > Thanks, > > - Bram