如何使用仅返回分页结果的NEST客户端返回具有计数的组:
ElasticClient client = GetEsConnection(); //ignore the details
var searchResult = client.Search<Activity>(s=>s
.Index(ElasticSearchConstants.EntityActivitiesIndex)
.Type(ElasticSearchConstants.EntityActivitiesType)
.Query(q=>q.ConstantScore(cs=>cs.Filter(f=>f
.Bool(b=>b
.Must(GetActivitiesQuery(request))))))
.Fields(fields)
.Sort(ss=>ss.Descending(sortBy))
.Skip(0)
.Take(10));
在上面的示例中,Activity有一个名为ActivityType的属性,我想返回每个活动类型的摘要计数。我怎么能这样做?