elasticsearch/elasticsearch — pull request #6885 by areek (2014-07-15 21:27:10+00:00)
Title: Implement early termination for Count API, if threshold is provided

A new request param `threshold` is added, which will allow Count query to early terminate, once the number of matched docs is equal to `threshold` for every shard. This will be helpful for exists-type functionality.