Geo Bounding Box Query Usageedit

Fluent DSL exampleedit

q
.GeoBoundingBox(g => g
    .Boost(1.1)
    .Name("named_query")
    .Field(p => p.LocationPoint)
    .BoundingBox(b => b
        .TopLeft(34, -34)
        .BottomRight(-34, 34)
    )
    .ValidationMethod(GeoValidationMethod.Strict)
    .Type(GeoExecution.Indexed)
    .IgnoreUnmapped(true)
)

Object Initializer syntax exampleedit

new GeoBoundingBoxQuery
{
    Boost = 1.1,
    Name = "named_query",
    Field = Infer.Field<Project>(p => p.LocationPoint),
    BoundingBox = new Nest.BoundingBox
    {
        TopLeft = new GeoLocation(34, -34),
        BottomRight = new GeoLocation(-34, 34),
    },
    Type = GeoExecution.Indexed,
    ValidationMethod = GeoValidationMethod.Strict,
    IgnoreUnmapped = true
}

Example json output.

{
  "geo_bounding_box": {
    "type": "indexed",
    "validation_method": "strict",
    "_name": "named_query",
    "boost": 1.1,
    "locationPoint": {
      "top_left": {
        "lat": 34.0,
        "lon": -34.0
      },
      "bottom_right": {
        "lat": -34.0,
        "lon": 34.0
      }
    },
    "ignore_unmapped": true
  }
}

Fluent DSL exampleedit

q
.GeoBoundingBox(g => g
    .Boost(1.1)
    .Name("named_query")
    .Field(p => p.LocationPoint)
    .BoundingBox(b => b
        .WellKnownText("BBOX (-34, 34, 34, -34)")
    )
    .ValidationMethod(GeoValidationMethod.Strict)
    .Type(GeoExecution.Indexed)
    .IgnoreUnmapped(true)
)

Object Initializer syntax exampleedit

new GeoBoundingBoxQuery
{
    Boost = 1.1,
    Name = "named_query",
    Field = Infer.Field<Project>(p => p.LocationPoint),
    BoundingBox = new Nest.BoundingBox
    {
        WellKnownText = "BBOX (-34, 34, 34, -34)"
    },
    Type = GeoExecution.Indexed,
    ValidationMethod = GeoValidationMethod.Strict,
    IgnoreUnmapped = true
}

Example json output.

{
  "geo_bounding_box": {
    "type": "indexed",
    "validation_method": "strict",
    "_name": "named_query",
    "boost": 1.1,
    "locationPoint": {
      "wkt": "BBOX (-34, 34, 34, -34)"
    },
    "ignore_unmapped": true
  }
}