A newer version is available. For the latest information, see the
current release documentation.
Geo Hash Grid Aggregation Usage
editGeo Hash Grid Aggregation Usage
editFluent DSL example
edita => a .GeoHash("my_geohash_grid", g => g .Field(p => p.LocationPoint) .GeoHashPrecision(GeoHashPrecision.Precision3) .Size(1000) .ShardSize(100) )
Object Initializer syntax example
editnew 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
editresponse.ShouldBeValid(); var myGeoHashGrid = response.Aggregations.GeoHash("my_geohash_grid"); myGeoHashGrid.Should().NotBeNull();
Fluent DSL example
edita => a .GeoHash("my_geohash_grid", g => g .Field(p => p.LocationPoint) .Bounds(b => b .TopLeft(90,-180) .BottomRight(-90, 180) ) )
Object Initializer syntax example
editnew GeoHashGridAggregation("my_geohash_grid") { Field = Field<Project>(p => p.LocationPoint), Bounds = new BoundingBox { TopLeft = new GeoLocation(90, -180), BottomRight = new GeoLocation(-90, 180) } }
Example json output.
{ "my_geohash_grid": { "geohash_grid": { "field": "locationPoint", "bounds": { "top_left": { "lat": 90.0, "lon": -180.0 }, "bottom_right": { "lat": -90.0, "lon": 180.0 } } } } }
Handling Responses
editresponse.ShouldBeValid(); var myGeoHashGrid = response.Aggregations.GeoHash("my_geohash_grid"); myGeoHashGrid.Should().NotBeNull();