Geo Hash Grid Aggregation Usageedit

Fluent DSL exampleedit

s => s
.Aggregations(a => a
    .GeoHash("my_geohash_grid", g => g
        .Field(p => p.Location)
        .GeoHashPrecision(GeoHashPrecision.Precision3)
        .Size(1000)
        .ShardSize(100)
    )
)

Object Initializer syntax exampleedit

new SearchRequest<Project>
{
    Aggregations = new GeoHashGridAggregation("my_geohash_grid")
    {
        Field = Field<Project>(p => p.Location),
        Precision = GeoHashPrecision.Precision3,
        Size = 1000,
        ShardSize = 100
    }
}

Example json output.

{
  "aggs": {
    "my_geohash_grid": {
      "geohash_grid": {
        "field": "location",
        "precision": 3,
        "size": 1000,
        "shard_size": 100
      }
    }
  }
}

Handling Responsesedit

response.ShouldBeValid();
var myGeoHashGrid = response.Aggs.GeoHash("my_geohash_grid");
myGeoHashGrid.Should().NotBeNull();