Geo Tile Grid Aggregation Usage

edit

Fluent DSL example

edit
a => a
.GeoTile("my_geotile", g => g
    .Field(p => p.LocationPoint)
    .Precision(GeoTilePrecision.Precision3)
    .Size(1000)
    .ShardSize(100)
)

Object Initializer syntax example

edit
new GeoTileGridAggregation("my_geotile")
{
    Field = Field<Project>(p => p.LocationPoint),
    Precision = GeoTilePrecision.Precision3,
    Size = 1000,
    ShardSize = 100
}

Example json output.

{
  "my_geotile": {
    "geotile_grid": {
      "field": "locationPoint",
      "precision": 3,
      "size": 1000,
      "shard_size": 100
    }
  }
}

Handling Responses

edit
response.ShouldBeValid();
var myGeoTileGrid = response.Aggregations.GeoTile("my_geotile");
myGeoTileGrid.Should().NotBeNull();
var firstBucket = myGeoTileGrid.Buckets.First();
firstBucket.Key.Should().NotBeNullOrWhiteSpace();
firstBucket.DocCount.Should().BeGreaterThan(0);