I am getting error when giving multiple term aggregation in composite aggregation sources
[es/search] failed: [x_content_parse_exception] [1:177] [composite] failed to parse field [sources]
my code as below
Map<String, CompositeAggregationSource> map = new HashMap<>();
map.put("Term1",
new CompositeAggregationSource.Builder().terms(d->d
.order(NamedValue.of("_key",SortOrder.Asc))
.field("agent.name")
).build()
);
map.put("Term2",
new CompositeAggregationSource.Builder().terms(d->d
.order(NamedValue.of("_key",SortOrder.Asc))
.field("agent.type")
).build()
);
List<Map<String, CompositeAggregationSource>> list = new ArrayList<>();
list.add(map);
SearchResponse<Void> response = client.search(b -> b
.index("*winlogbeat*")
.size(0)
.aggregations("name", t->t
.composite(t1->t1
.sources(map)))
,
Void.class
);
How to give multiple Term Aggregation in composite Aggregation ?