Specification<Composite> whereClause,
Map<String, Object> variables )
throws EntityFinderException
{
// Prepare request
CountRequestBuilder request = support.client().prepareCount( support.index() );
AndFilterBuilder filterBuilder = baseFilters( resultType );
QueryBuilder queryBuilder = processWhereSpecification( filterBuilder, whereClause, variables );
request.setQuery( filteredQuery( queryBuilder, filterBuilder ) );
// Log
LOGGER.debug( "Will count Entities: {}", request );
// Execute
CountResponse count = request.execute().actionGet();
return count.getCount();
}