Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var response = Client.Search<myclass>(s => s
- .Type("type")
- .Aggregations(a => a
- .Terms("code_bucket", t => t
- .Field("field_of_aggregation")
- .Size(30)
- .Order(TermsOrder.CountAscending)
- .Aggregations(a2 => a2
- .TopHits("code_bucket_top_hits", th => th.Size(20))
- )
- )));
- var firstBucket= response.Aggs.Terms("code_bucket");
- foreach (var bucket in firstBucket.Buckets)
- {
- var hits = bucket.TopHits("code_bucket_top_hits");
- foreach (var hit in hits.Documents<myclass>())
- {
- var prop1= hit.prop1;
- var prop2= hit.prop2;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement