Datehistogram Composite Agg Sort Error in new Java Client

I am getting error when giving sort in Datehistogram composite agg

[es/search] failed: [x_content_parse_exception] [1:186] [composite] failed to parse field [sources]

my code as below

Map<String, CompositeAggregationSource> map = new HashMap<>();
            map.put("datehistogram",
                    new CompositeAggregationSource.Builder().dateHistogram(d->d
                                    .order(NamedValue.of("_key",SortOrder.Desc))
                                    .timeZone("UTC")
                                    .field("@timestamp")
                                    .calendarInterval(CalendarInterval.Day)
                            ).build()
                    );

            SearchResponse<Void> response = client.search(b -> b
                            .index("*winlogbeat*")
                            .size(0)
                            .aggregations("date", t->t
                                    .composite(t1->t1
                                            .sources(map)))
                    ,
                    Void.class
            );

How to give sort in composite Agg Datehistogram ?

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