Does Elasticsearch have a mechanism to query for documents while limiting that only a number of those documents match a separate condition?
I have a collection of documents that have a field indicating a category. Is it possible to query for 100 documents that matches some criteria, while limiting that no more than 20 of those documents have category=A? A similar scenario would be to query for 100 documents while specifying that 20 documents must be of category=A, 30 of category=B and 50 of category C.