1 | <?php |
||
10 | class GeohashGrid extends AbstractAggregation |
||
11 | { |
||
12 | public const DEFAULT_PRECISION_VALUE = 5; |
||
13 | public const DEFAULT_SIZE_VALUE = 10000; |
||
14 | |||
15 | /** |
||
16 | * @param string $name the name of this aggregation |
||
17 | * @param string $field the field on which to perform this aggregation |
||
18 | */ |
||
19 | public function __construct(string $name, string $field) |
||
24 | |||
25 | /** |
||
26 | * Set the field for this aggregation. |
||
27 | * |
||
28 | * @param string $field the name of the document field on which to perform this aggregation |
||
29 | * |
||
30 | * @return $this |
||
31 | */ |
||
32 | public function setField(string $field): self |
||
36 | |||
37 | /** |
||
38 | * Set the precision for this aggregation. |
||
39 | * |
||
40 | * @param int $precision an integer between 1 and 12, inclusive. Defaults to 5. |
||
41 | * |
||
42 | * @return $this |
||
43 | */ |
||
44 | public function setPrecision(int $precision): self |
||
48 | |||
49 | /** |
||
50 | * Set the precision for this aggregation in meters or kilometers. |
||
51 | * |
||
52 | * @param string $precision a string like 100m or 1km |
||
53 | * |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function setDistancePrecision(string $precision): self |
||
60 | |||
61 | /** |
||
62 | * Set the maximum number of buckets to return. |
||
63 | * |
||
64 | * @param int $size defaults to 10,000 |
||
65 | * |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function setSize(int $size): self |
||
72 | |||
73 | /** |
||
74 | * Set the number of results returned from each shard. |
||
75 | * |
||
76 | * @return $this |
||
77 | */ |
||
78 | public function setShardSize(int $shardSize): self |
||
82 | } |
||
83 |