This really sounds like an XY problem. The whole point of facets is to count the number of documents that have a value in some number of buckets. So trying to stop your facet query as soon as it matches a hit for the first time seems like an odd thing to do.
So what’s the “X”? In other words, what is the problem you’re trying to solve at a high level? Perhaps there’s a better way to figure this out. Best, Erick > On Oct 28, 2020, at 3:48 AM, michael dürr <due...@gmail.com> wrote: > > Hi, > > I use json facets of type 'query'. As these queries are pretty slow and I'm > only interested in whether there is a match or not, I'd like to restrict > the query execution similar to the standard facetting (like with the > facet.exists parameter). My simplified query looks something like this (in > reality *:* may be replaced by a complex edismax query and multiple > subfacets similar to "tour" occur): > > curl http://localhost:8983/solr/portal/select -d \ > "q=*:*\ > &json.facet={ > tour:{ > type : query, > q: \"+(+categoryId:6000 -categoryId:(6061 21493 8510))\" > } > }\ > &rows=0" > > Is there any possibility to modify my request to ensure that the facet > query stops as soon as it matches a hit for the first time? > > Thanks! > Michael