Skip to content

Commit 6d8ab5e

Browse files
committed
Agg metadata now serialized correctly on the request
1 parent c509515 commit 6d8ab5e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/Nest/Aggregations/Aggregation.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ namespace Nest
77
public interface IAggregation
88
{
99
string Name { get; set; }
10-
11-
[JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter))]
12-
[JsonProperty("meta")]
1310
IDictionary<string, object> Meta { get; set; }
1411
}
1512

src/Nest/Aggregations/AggregationContainer.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public static implicit operator AggregationDictionary(AggregationBase aggregator
5050
[JsonConverter(typeof(ReadAsTypeJsonConverter<AggregationContainer>))]
5151
public interface IAggregationContainer
5252
{
53+
[JsonProperty("meta")]
54+
[JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter))]
55+
IDictionary<string, object> Meta { get; set; }
56+
5357
[JsonProperty("avg")]
5458
IAverageAggregation Average { get; set; }
5559

@@ -178,6 +182,7 @@ public interface IAggregationContainer
178182

179183
public class AggregationContainer : IAggregationContainer
180184
{
185+
public IDictionary<string, object> Meta { get; set; }
181186
public IAverageAggregation Average { get; set; }
182187
public IValueCountAggregation ValueCount { get; set; }
183188
public IMaxAggregation Max { get; set; }
@@ -273,6 +278,8 @@ public void Accept(IAggregationVisitor visitor)
273278
public class AggregationContainerDescriptor<T> : DescriptorBase<AggregationContainerDescriptor<T>, IAggregationContainer>, IAggregationContainer
274279
where T : class
275280
{
281+
IDictionary<string, object> IAggregationContainer.Meta { get; set; }
282+
276283
AggregationDictionary IAggregationContainer.Aggregations { get; set; }
277284

278285
IAverageAggregation IAggregationContainer.Average { get; set; }
@@ -527,9 +534,10 @@ Func<TAggregator, TAggregatorInterface> selector
527534
where TAggregatorInterface : IAggregation
528535
{
529536
var aggregator = selector(new TAggregator());
530-
537+
531538
//create new isolated container for new aggregator and assign to the right property
532-
var container = new AggregationContainer();
539+
var container = new AggregationContainer() { Meta = aggregator.Meta };
540+
533541
assignToProperty(container, aggregator);
534542

535543
//create aggregations dictionary on `this` if it does not exist already

0 commit comments

Comments
 (0)