Geo Line Aggregation Usage

edit

The geo_line aggregation aggregates all geo_point values within a bucket into a LineString ordered by the chosen sort field.

Be sure to read the Elasticsearch documentation on Geo-Line Aggregation.

Fluent DSL example

edit
a => a
.GeoLine("line", d => d
    .Point(p => p.LocationPoint)
    .Sort(p => p.StartedOn)
    .IncludeSort()
    .Size(25))

Object Initializer syntax example

edit
new GeoLineAggregation("line", Field<Project>(f => f.LocationPoint), Field<Project>(f => f.StartedOn))
{
    IncludeSort = true,
    Size = 25
}

Example json output.

{
  "line": {
    "geo_line": {
      "point": {
        "field": "locationPoint"
      },
      "sort": {
        "field": "startedOn"
      },
      "include_sort": true,
      "size": 25
    }
  }
}

Handling Responses

edit
response.ShouldBeValid();
var geoLine = response.Aggregations.GeoLine("line");
geoLine.Should().NotBeNull();
geoLine.Type.Should().Be("Feature");
geoLine.Geometry.Type.Should().Be("linestring");
geoLine.Geometry.Coordinates.Should().NotBeEmpty();
geoLine.Properties.Complete.Should().BeFalse();
geoLine.Properties.SortValues.Should().NotBeEmpty();