Indeed SearchType.COUNT would work great as it would ensure that a single round-trip is performed. Other than that, if you want to filter content on which you want to aggregate, make sure to put it in a filtered query as opposed to a filter aggregation: since aggregations are executed on every matching document, this would evaluate the filter against every document (since the default query, match_all, matches them all) while if you put the filter in the query, elasticsearch would be able to quickly skip over non-matching documents.
-- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j5pjEWsMX3zZiUJLcyW3d77CzV6jd83AT7A6xRRLX-PHQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
