Search in sources :

Example 1 with InternalTopHits

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());
}
Also used : InternalTopHits(org.elasticsearch.search.aggregations.metrics.tophits.InternalTopHits) SearchHit(org.elasticsearch.search.SearchHit) SearchHits(org.elasticsearch.search.SearchHits)

Aggregations

SearchHit (org.elasticsearch.search.SearchHit)1 SearchHits (org.elasticsearch.search.SearchHits)1 InternalTopHits (org.elasticsearch.search.aggregations.metrics.tophits.InternalTopHits)1