Skip to content

Commit 9555514

Browse files
committed
Manually map histogram aggregation item to support ES 1.2 response as well as 1.1 and 1.0
1 parent 2b5c7ce commit 9555514

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Nest/Domain/Aggregations/AggregationsHelper.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.Linq;
34

@@ -109,7 +110,18 @@ public Bucket<HistogramItem> Histogram(string key)
109110
{
110111
var bucket = this.TryGet<Bucket>(key);
111112
var b = new Bucket<HistogramItem>();
112-
b.Items = bucket.Items.OfType<HistogramItem>().ToList();
113+
114+
b.Items = bucket.Items.OfType<KeyItem>()
115+
.Select(x =>
116+
new HistogramItem
117+
{
118+
Key = long.Parse(x.Key),
119+
KeyAsString = x.Key,
120+
DocCount = x.DocCount
121+
}
122+
)
123+
.ToList();
124+
113125
return b;
114126
}
115127

0 commit comments

Comments
 (0)