Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TermsAggregation topTermAgg = null;
- TermsAggregation currentAgg = null;
- foreach (var pivotName in activePivots)
- {
- newTermAgg = new TermsAggregation("pivot")
- {
- Field = pivot.ToString().ToLower()
- };
- if (topTermAgg == null)
- {
- topTermAgg = newTermAgg;
- }
- else
- {
- currentAgg.Aggregations = newTermAgg;
- }
- currentAgg = newTermAgg;
- }
- var searchRequest = new SearchRequest(Indices.Index("a", "b", "c"))
- {
- Size = 0,
- Aggregations = topTermAgg,
- Query = query,
- };
- {
- "size": 0,
- "query": {
- "bool": <Fairly complex query, that works fine. It's the aggregation that has the problem.>
- },
- "aggs": {
- "pivot": {
- "terms": {
- "field": "pivot1"
- },
- "aggs": {
- "pivot": {
- "terms": {
- "field": "pivot2"
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment