Elastic
search provides count API, to get the number of matches for a given query.
public
static CountResponse getNumberOfMatches(Client client,
QueryBuilder builder,
String... indices) {
return
client.prepareCount(indices).setQuery(builder).execute().actionGet();
}
No comments:
Post a Comment