At the moment, there is no option to just check if query matches any
documents other then using the count API or the count search type and
checking #hits > 0. In Lucene you could use early termination
(CollectionTerminatedException) to stop enumerating docs when the first
document is found - so we can do something there.
If the #hits>0 is not fast enough for you, I suggest you open an issue,
including and example of your use case, the timing involved and why they
are not good enough for you.
Of course, you can also have some fun writing a plugin/a pull request with
an extra endpoint (modelled after the Count API) and see how much that
helps. Shouldn't be too hard and is a nice exercise
On Monday, September 23, 2013 3:22:20 PM UTC+2, Peter van der Weerd wrote:
I noticed that there is a count API, that is basically a query without
scoring, but only count the #hits.
Now I need to know whether a query has results or not.
Of course I can do that by doing a count and then test of 0 results, but
that is probably not the most efficient approach.
Also the exists filter seems no to solve this problem.
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/groups/opt_out.