Nest -需要弹性响应模拟的帮助


"aggregations" : {
"filter#count_stats" : {
"doc_count" : 30,
"lterms#Name1" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : 53986,
"doc_count" : 2,
"sterms#Name2" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "Soft",
"doc_count" : 7,
},
{
"key" : "Health",
"doc_count" : 5
},
]
}
},
{
"key" : 40127,
"doc_count" : 1,
"sterms#Name3" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "XYZ",
"doc_count" : 3
}
]
}
}
]
}
}
}
IReadOnlyDictionary<string, IAggregate> dictionary = new Dictionary<string, IAggregate>();
var keyedAggregate1 = new KeyedBucket<object>(dictionary) { Key = "Soft", DocCount = 7};
var keyedAggregate2 = new KeyedBucket<object>(dictionary) { Key = "Health", DocCount = 8 };
var keyedAggregate3 = new KeyedBucket<object>(dictionary) { Key = "XYZ", DocCount = 3 };
var backingListDeals1 = new List<IBucket>
{
keyedAggregate1,
keyedAggregate2
};
var backingListDeals2 = new List<IBucket>
{
keyedAggregate3
};
var bucketAggregate1 = new BucketAggregate()
{
Items = backingListDeals1,
DocCount = 2
};
var bucketAggregate2 = new BucketAggregate()
{
Items = backingListDeals2,
DocCount = 2
};
var backingDictionary = new Dictionary<string, IAggregate> {{"count_stats", new BucketAggregate
{
Items = new List<IBucket>
{
new KeyedBucket<object>(new Dictionary<string, IAggregate>{{ "Name2", bucketAggregate1 } })
{
Key = "53986",
DocCount = 2
},
new KeyedBucket<object>(new Dictionary<string, IAggregate>{{ "Name2", bucketAggregate2 } })
{
Key = "40127",
DocCount = 1
}
}
}}};
var singleBucketAggregate = new SingleBucketAggregate(backingDictionary);
IReadOnlyDictionary<string, IAggregate> backingDictionary = new Dictionary<string, IAggregate>
{
{ "count_stats", singleBucketAggregate   }
};
return new AggregateDictionary(backingDictionary);

最新更新