IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Geo Distance Query Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Geo Distance Query Usage
editFluent DSL example
editq
.GeoDistance(g => g
.Boost(1.1)
.Name("named_query")
.Field(p => p.LocationPoint)
.DistanceType(GeoDistanceType.Arc)
.Location(34, -34)
.Distance("200m")
.ValidationMethod(GeoValidationMethod.IgnoreMalformed)
)
Object Initializer syntax example
editnew GeoDistanceQuery
{
Boost = 1.1,
Name = "named_query",
Field = Infer.Field<Project>(p => p.LocationPoint),
DistanceType = GeoDistanceType.Arc,
Location = new GeoLocation(34, -34),
Distance = "200m",
ValidationMethod = GeoValidationMethod.IgnoreMalformed
}
Example json output.
{
"geo_distance": {
"_name": "named_query",
"boost": 1.1,
"distance": "200m",
"distance_type": "arc",
"validation_method": "ignore_malformed",
"locationPoint": {
"lat": 34.0,
"lon": -34.0
}
}
}