Skip to content

Instantly share code, notes, and snippets.

@alkampfergit
alkampfergit / gist:19cc4314874c4f754b59
Last active August 29, 2015 14:12
Regex Filter aggregation with NEST
.....
//this filters result of the query, then apply aggregations on terms.
//if you want to filter result of the aggregation you will need reducers
//https://github.com/elasticsearch/elasticsearch/issues/8110
.Aggregations(a1 => a1
.Filter("filter", fd => fd.Filter(f =>
f.Regexp(f3 => f3
.OnField(d => d.MdFacets)
.Value(parameters.FacetName + @"\|.*"))
@alkampfergit
alkampfergit / gist:bcb8364c67ba7703152a
Created December 15, 2014 16:46
NEventStore mongo provider get count of events by type
db.Commits.aggregate([
{$sort: {_id:1}},
{$unwind : "$Events"},
{$project : { event : '$Events.Payload.Body._t'}},
{$group : {
'_id' : '$event',
'count' : {$sum : 1}}
}
])