I need to query certain fields, after aggregating.
Document structure is:
{
id: 1,
type: AA,
hashValue: "qweqeqwdwwew"
...and many more fields
}
I want to aggregate by 'hashValue', so that i get only unique hashValues and the return results should also have the type. I need help with NEST query.
The current query to aggregate is:
var result = esClient.Search < EType > (q => q
.Index(esClient.Index)
.Routing(id.ToString(CultureInfo.InvariantCulture))
.Aggregations(ag => ag
.Terms("Hash", ee => ee
.Field(f => f.hashValue)))));
How can i extend it return type field along with hashValue?
Thanks.