Geo Distance Query Usageedit

Fluent DSL exampleedit

q
.GeoDistance(g=>g
    .Boost(1.1)
    .Name("named_query")
    .Field(p=>p.Location)
    .DistanceType(GeoDistanceType.Arc)
    .Location(34, -34)
    .Distance("200.0m")
    .Optimize(GeoOptimizeBBox.Memory)
    .ValidationMethod(GeoValidationMethod.IgnoreMalformed)
)

Object Initializer syntax exampleedit

new GeoDistanceQuery
{
    Boost = 1.1,
    Name = "named_query",
    Field = Infer.Field<Project>(p => p.Location),
    DistanceType = GeoDistanceType.Arc,
    Location = new GeoLocation(34,-34),
    Distance = "200.0m",
    OptimizeBoundingBox = GeoOptimizeBBox.Memory,
    ValidationMethod = GeoValidationMethod.IgnoreMalformed
}

Example json output. 

{
  "geo_distance": {
    "_name": "named_query",
    "boost": 1.1,
    "distance": "200.0m",
    "optimize_bbox": "memory",
    "distance_type": "arc",
    "validation_method": "ignore_malformed",
    "location": {
      "lat": 34.0,
      "lon": -34.0
    }
  }
}