Elasticsearch took field

When using the search api elasticsearch returns "took" as part of the response, which gives some insight into the query execution time, however I don't get that using the count API.

Is there a way to get some timing information from elasticsearch for count queries ?

If not, are search and count APIs identical in terms of performance when only using filters ? Basically would there be any performance hit if I use the search api to the get counts ? (Assuming I set "size": 0 in the request body so ES doesn't returns hits)

The search and count APIs ought to be identical in terms of performance if you set size=0, yes. I'd experiment with setting adding a constant_score_query just to make sure that we're not calculating scores with 0 size but I believe we aren't.

1 Like