Trying to Write NEST Query in C# for the following DSL
GET staff/_search
{
"size": 0,
"aggregations" : {
"groupby" : {
"composite" : {
"size" : 1000,
"sources" : [
{
"437" : {
"terms" : {
"field" : "id.keyword",
"missing_bucket" : true,
"order" : "asc"
}
}
},
{
"439" : {
"terms" : {
"field" : "salary",
"missing_bucket" : true,
"order" : "asc"
}
}
}
]
}
}
}
}
Trying to write as :
var result = _connection.Search<staff>(Id => Id.Index("staff").Size(0)
.Aggregations(a => a.Composite("groupBy",
c => c.Sources(s =>
s.Terms("id", t =>
t.Field(f => f.id.Suffix("keyword"))
&&
s.Terms("id", t =>
t.Field(f => f.salary)
)
)
)
)
);
Getting error : Getting error : Operator '&&' cannot be applied to operands of type TermsCompositeAggregationSourceDescriptor and CompositeAggregationSourceDescriptor