use of org.elasticsearch.search.aggregations.metrics.tophits.InternalTopHits in project sonarqube by SonarSource.
the class ComponentIndex method bucketToQualifier.
private static ComponentsPerQualifier bucketToQualifier(Bucket bucket) {
InternalTopHits docs = bucket.getAggregations().get(DOCS_AGGREGATION_NAME);
SearchHits hitList = docs.getHits();
SearchHit[] hits = hitList.getHits();
List<String> componentUuids = Arrays.stream(hits).map(SearchHit::getId).collect(Collectors.toList(hits.length));
return new ComponentsPerQualifier(bucket.getKey(), componentUuids, hitList.totalHits());
}
Aggregations