private int retrieveSearchObjectsResultCount(SearchResponse response) { Aggregation objectsCountAggregation = resolveChildAggregation(response.getAggregations(), OBJECTS_COUNT_AGGREGATION_NAME); if (!(objectsCountAggregation instanceof Cardinality)) { LOGGER.warning("Could not retrieve result count when searching for Objects."); return -1; } // Retrieve Object count from the cardinality aggregation. return (int) Cardinality.class.cast(objectsCountAggregation).getValue(); }
@Override public void onResponse(SearchResponse searchResponse) { Cardinality c = searchResponse.getAggregations().get(context.getNode().getLookupPath()); context.getNode().setCardinality(c.getValue()); reporter.success(context); }
long total = ((Cardinality)(response.getAggregations().get(COUNT_AGGREGATION))).getValue(); List<Document> docs; if (total == 0) {