Skip to content

Commit 0fed683

Browse files
committed
Merge branch 'master' of github.com:elastic/elasticsearch-net
2 parents 413ae6f + 6ccb66f commit 0fed683

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/Nest/Aggregations/Metric/ExtendedStats/ExtendedStatsAggregation.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,31 @@ namespace Nest
44
{
55
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
66
[ContractJsonConverter(typeof(AggregationJsonConverter<ExtendedStatsAggregation>))]
7-
public interface IExtendedStatsAggregation : IMetricAggregation { }
7+
public interface IExtendedStatsAggregation : IMetricAggregation
8+
{
9+
[JsonProperty("sigma")]
10+
double Sigma { get; set; }
11+
}
812

913
public class ExtendedStatsAggregation : MetricAggregationBase, IExtendedStatsAggregation
1014
{
1115
internal ExtendedStatsAggregation() { }
1216

1317
public ExtendedStatsAggregation(string name, Field field) : base(name, field) { }
1418

19+
public double Sigma { get; set; }
20+
1521
internal override void WrapInContainer(AggregationContainer c) => c.ExtendedStats = this;
1622
}
1723

18-
public class ExtendedStatsAggregationDescriptor<T>
24+
public class ExtendedStatsAggregationDescriptor<T>
1925
: MetricAggregationDescriptorBase<ExtendedStatsAggregationDescriptor<T>, IExtendedStatsAggregation, T>
20-
, IExtendedStatsAggregation
21-
where T : class { }
22-
}
26+
, IExtendedStatsAggregation
27+
where T : class
28+
{
29+
double IExtendedStatsAggregation.Sigma { get; set; }
30+
31+
public ExtendedStatsAggregationDescriptor<T> Sigma(double sigma) =>
32+
Assign(a => a.Sigma = sigma);
33+
}
34+
}

src/Tests/Aggregations/Metric/ExtendedStats/ExtendedStatsAggregationUsageTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public ExtendedStatsAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
2121
{
2222
extended_stats = new
2323
{
24-
field = "numberOfCommits"
24+
field = "numberOfCommits",
25+
sigma = 1d
2526
}
2627
}
2728
}
@@ -31,13 +32,14 @@ public ExtendedStatsAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
3132
.Aggregations(a => a
3233
.ExtendedStats("commit_stats", es => es
3334
.Field(p => p.NumberOfCommits)
35+
.Sigma(1)
3436
)
3537
);
3638

3739
protected override SearchRequest<Project> Initializer =>
3840
new SearchRequest<Project>
3941
{
40-
Aggregations = new ExtendedStatsAggregation("commit_stats", Field<Project>(p => p.NumberOfCommits))
42+
Aggregations = new ExtendedStatsAggregation("commit_stats", Field<Project>(p => p.NumberOfCommits)) { Sigma = 1 }
4143
};
4244

4345
protected override void ExpectResponse(ISearchResponse<Project> response)

0 commit comments

Comments
 (0)