Count or Search with size=0

(raj shah) #1

I am using ElasticSearch v2.4.0.

Which operations out of (Count) or (Search with size=0) will be faster in fetching the response count?

Since, count API for Java is deprecated for versions after 2.1.0, Is (Search with size=0) the same in terms of performance or any better operation is available for counting the records?

Thanks in advance.

(Nik Everett) #2

Search with size 0 should be the same performance as count. You can also look at terminate_after if you only need a "does this exist".

(raj shah) #3


I have millions of documents in my index and I just want the count of the results when I perform a particular search query.

So, will search with size=0 be faster than count in terms of performance, when the data is huge?

(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.