You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Geo Distance aggregationedit
A multi-bucket aggregation that works on geo_point fields and conceptually works very similar to the range aggregation.
Fluent DSLedit
var result = client.Search<ElasticsearchProject>(s => s
.Aggregations(a => a
.GeoDistance("my_geo_distance_agg", g => g
.Field(p => p.Origin)
.Origin("93.57, 93.57")
.Ranges(
r => r.To(100),
r => r.From(100).To(300),
r => r.From(300)
)
)
)
);
var agg = result.Aggs.GeoDistance("my_geo_distance_agg");Object Initializer Syntaxedit
var request = new SearchRequest
{
Aggregations = new Dictionary<string, IAggregationContainer>
{
{ "my_geo_distance_agg", new AggregationContainer
{
GeoDistance = new GeoDistanceAggregator
{
Field = "origin",
Origin = "93.57, 93.57",
Ranges = new List<Range<double>>
{
new Range<double>().To(100),
new Range<double>().From(100).To(300),
new Range<double>().From(300)
}
}
}
}
}
};
var result = client.Search<ElasticsearchProject>(request);
var agg = result.Aggs.GeoDistance("my_geo_distance_agg");Refer to the original docs for more information.