\Elastica\AggregationGeoDistance

Class GeoDistance.

Summary

Methods
Properties
Constants
__construct()
setField()
setOrigin()
addRange()
setUnit()
setDistanceType()
No public properties found
DISTANCE_TYPE_ARC
DISTANCE_TYPE_PLANE
DEFAULT_DISTANCE_TYPE_VALUE
DEFAULT_UNIT_VALUE
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

DISTANCE_TYPE_ARC

DISTANCE_TYPE_ARC

DISTANCE_TYPE_PLANE

DISTANCE_TYPE_PLANE

DEFAULT_DISTANCE_TYPE_VALUE

DEFAULT_DISTANCE_TYPE_VALUE

DEFAULT_UNIT_VALUE

DEFAULT_UNIT_VALUE

Methods

__construct()

__construct(string  $name, string  $field, string|array  $origin) 

Parameters

string $name

the name if this aggregation

string $field

the field on which to perform this aggregation

string|array $origin

the point from which distances will be calculated

setField()

setField(string  $field) : $this

Set the field for this aggregation.

Parameters

string $field

the name of the document field on which to perform this aggregation

Returns

$this

setOrigin()

setOrigin(string|array  $origin) : $this

Set the origin point from which distances will be calculated.

Parameters

string|array $origin

valid formats are array("lat" => 52.3760, "lon" => 4.894), "52.3760, 4.894", and array(4.894, 52.3760)

Returns

$this

addRange()

addRange(integer  $fromValue = null, integer  $toValue = null) : $this

Add a distance range to this aggregation.

Parameters

integer $fromValue

a distance

integer $toValue

a distance

Throws

\Elastica\Exception\InvalidException

Returns

$this

setUnit()

setUnit(string  $unit) : $this

Set the unit of distance measure for this aggregation.

Parameters

string $unit

defaults to m

Returns

$this

setDistanceType()

setDistanceType(string  $distanceType) : $this

Set the method by which distances will be calculated.

Parameters

string $distanceType

see DISTANCETYPE* constants for options. Defaults to arc.

Returns

$this