HIGH PRIORITY -> how to add subaggregtion in terms aggregation for spring-data-elasticsearch 5.1

i am rewriting my older verison elasticsearch implementations.
I latest spring-data-elasticsearch 5.1, queryBuilders got removed due to whic i am not able to use/ add "AggregationBuilders" inside my native query.
Can any one help me to add a tophits aggregation in the terms aggregation provided below.

NativeQuery nativeQuery = NativeQuery.builder()
            .withQuery(queryBuilder)
            .withAggregation("property_room", TermsAggregation.of(tagg -> {
                  tagg.script(
                    Script.of(sc -> sc.inline(insc -> {
                      insc.lang(ScriptLanguage.Painless);
                      insc.source( "//test code");
                      insc.params(Collections.emptyMap());
                      return insc;
                    })));
                  tagg.size(10000);
                  tagg.minDocCount(datesToSearch.size());
                  return tagg;})._toAggregation())         
            .withPageable(PageRequest.of(0, 10000))
            .build();

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.