Skip to content

Commit aa2a8f1

Browse files
committed
Fix #1403: Extended stats not read to completion
1 parent 9c531fa commit aa2a8f1

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/Nest/Resolvers/Converters/Aggregations/AggregationConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ private IAggregation GetExtendedStatsAggregation(StatsMetric statsMetric, JsonRe
239239
bounds.Lower = reader.Value as double?;
240240
}
241241
extendedStatsMetric.StdDeviationBounds = bounds;
242+
reader.Read();
243+
reader.Read();
242244
}
243245

244246
return extendedStatsMetric;

src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
<Compile Include="Reproduce\Reproduce1278Tests.cs" />
177177
<Compile Include="Reproduce\Reproduce1304Tests.cs" />
178178
<Compile Include="Reproduce\Reproduce1317Tests.cs" />
179+
<Compile Include="Reproduce\Reproduce1403Tests.cs" />
179180
<Compile Include="Reproduce\Reproduce769Tests.cs" />
180181
<Compile Include="Reproduce\Reproduce945Tests.cs" />
181182
<Compile Include="Reproduce\Reproduce953Tests.cs" />
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Nest.Tests.MockData.Domain;
2+
using NUnit.Framework;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using FluentAssertions;
9+
using Elasticsearch.Net;
10+
11+
namespace Nest.Tests.Integration.Reproduce
12+
{
13+
[TestFixture]
14+
public class Reproduce1403Tests : IntegrationTests
15+
{
16+
[Test]
17+
public void ExtendedStatsNotReadToCompletion()
18+
{
19+
var result = this.Client.Search<ElasticsearchProject>(s => s
20+
.SearchType(SearchType.Count)
21+
.Aggregations(a => a
22+
.ExtendedStats("a", stats => stats.Field(p => p.LongValue))
23+
.ExtendedStats("b", stats => stats.Field(p => p.LOC))
24+
)
25+
);
26+
27+
result.IsValid.Should().BeTrue();
28+
result.Aggregations.Count.Should().Be(2);
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)