Geo Hash Grid Aggregation Usage

edit

Fluent DSL example

edit
a => a
.GeoHash("my_geohash_grid", g => g
    .Field(p => p.LocationPoint)
    .GeoHashPrecision(GeoHashPrecision.Precision3)
    .Size(1000)
    .ShardSize(100)
)

Object Initializer syntax example

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

Example json output.

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

Handling Responses

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