Hello dear community,
I am currently migrating our ES7 to ES8 and am now encountering the problem that I cannot find a solution as to how I can migrate SearchHits or the .get(String) method.
public static Set<Integer> 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()));
}
return result;
}
I am now using org.springframework.data:spring-data-elasticsearch:5.1.5 with the migration to ES8
Would be very grateful for any help on how I can change this method so that it works with ES8.