AggregationContainer .get missing in spring-data-elasticsearch 4.4.x

21 views Asked by At

does anyone have an idea how I can use this aggregation in spring-data-elasticsearch 4.4.x, as the .get(String) method has disappeared from the AggregationContainer? Unfortunately, I haven't found a solution to this problem yet. Even this solution did not work, because my used library (import org.springframework.data.elasticsearch.client.elc.ElasticsearchAggregations; ) does not have the aggregationsAsMap() method either.

Would be thankful for any solution.

public static Set<ElasticSearchArticleDto> getAggregations(SearchHits<ElasticSearchArticleDto> search, String aggregation) {
    Set<Integer> result = new LinkedHashSet<>();

    if (search.getAggregations() != null && search.getAggregations().get(aggregation) != null) {
      ((ParsedLongTerms) search.getAggregations().get(aggregation)).getBuckets()
        .forEach(bucket -> result.add(bucket.getKeyAsNumber().intValue()));
    }
  }
0

There are 0 answers