How how use aggregations and pagination in java High Level Rest Client

Hello,

I'm using es version 7.1, and i want to paginate records with aggregation, the probleme is, i dont found tag from for controlling number of page for my aggregation

Here is my code

@Override
    public Maybe<SearchResponse> searchAsync(int count, int page, Criteres criteresRecherche) {
        SearchRequest searchRequest = new SearchRequest("my_index");
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.from(page);
        searchSourceBuilder.size(count);
        BoolQueryBuilder query = QueryBuilders.boolQuery();
        query
                .filter(QueryBuilders.rangeQuery("TIME")
                        .gte(criteresRecherche.getHeureDebut())
                        .lte(criteresRecherche.getHeureFin())
                        .format("HH:mm:ss"));
        query
                .filter(QueryBuilders.rangeQuery("DATE")
                        .gte(criteresRecherche.getDateDebut())
                        .lte(criteresRecherche.getDateFin())
                        .format("yyyy/MM/dd"));
						
        searchSourceBuilder.query(query);
        searchSourceBuilder
                .aggregation(
                        AggregationBuilders.terms("by_field").field("A.keyword")
                                .size(count)
                                .subAggregation(AggregationBuilders.terms("B").field("B.keyword"))
                                .subAggregation(AggregationBuilders.terms("D").field("D.keyword"))
                )
        ;
        searchRequest.source(searchSourceBuilder);
        return iaElasticSearchClient.searchAsync(searchRequest);
    }

Thank you in advance

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