Skip to content

Commit ab4b4b8

Browse files
committed
Fix #1474: GeoBounds aggregation not read to completion
1 parent 4b579a9 commit ab4b4b8

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

Diff for: src/Nest/Resolvers/Converters/Aggregations/AggregationConverter.cs

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ private IAggregation GetGeoBoundsMetricAggregation(JsonReader reader, JsonSerial
105105
if (bottomRight != null)
106106
geoBoundsMetric.Bounds.BottomRight = bottomRight;
107107
}
108+
reader.Read();
108109
return geoBoundsMetric;
109110
}
110111

Diff for: src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
<Compile Include="Reproduce\Reproduce1317Tests.cs" />
181181
<Compile Include="Reproduce\Reproduce1403Tests.cs" />
182182
<Compile Include="Reproduce\Reproduce1457Tests.cs" />
183+
<Compile Include="Reproduce\Reproduce1474Tests.cs" />
183184
<Compile Include="Reproduce\Reproduce769Tests.cs" />
184185
<Compile Include="Reproduce\Reproduce945Tests.cs" />
185186
<Compile Include="Reproduce\Reproduce953Tests.cs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using NUnit.Framework;
2+
using FluentAssertions;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using Nest.Tests.MockData.Domain;
9+
10+
namespace Nest.Tests.Integration.Reproduce
11+
{
12+
[TestFixture]
13+
public class Reproduce1474Tests : IntegrationTests
14+
{
15+
[Test]
16+
public void GeoBoundsAggregationNotReadToCompletion()
17+
{
18+
var response = this.Client.Search<ElasticsearchProject>(s => s
19+
.Aggregations(aggs => aggs
20+
.Terms("names", ct => ct
21+
.Field(p => p.Name)
22+
.Size(0)
23+
)
24+
.Terms("countries", at => at
25+
.Field(p => p.Country)
26+
.Size(0)
27+
)
28+
.GeoHash("locations", l => l
29+
.Field(f => f.Origin)
30+
.GeoHashPrecision(GeoHashPrecision.Precision6)
31+
)
32+
.GeoBounds("bounds", b => b
33+
.Field(f => f.Origin)
34+
)
35+
)
36+
);
37+
response.IsValid.Should().BeTrue();
38+
var names = response.Aggs.Terms("names");
39+
names.Should().NotBeNull();
40+
var countries = response.Aggs.Terms("countries");
41+
countries.Should().NotBeNull();
42+
var locations = response.Aggs.GeoHash("locations");
43+
locations.Should().NotBeNull();
44+
var bounds = response.Aggs.GeoBounds("bounds");
45+
bounds.Should().NotBeNull();
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)