Monday 23 November 2015

Elasticsearch: Java : Count API

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();

}



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment