1<?php
2
3namespace Elastica\Aggregation;
4
5/**
6 * A metric aggregation that computes the bounding box containing all geo_point values for a field.
7 *
8 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-geobounds-aggregation.html
9 */
10class GeoBounds extends AbstractAggregation
11{
12    /**
13     * @param string $name  the name of this aggregation
14     * @param string $field the field on which to perform this aggregation
15     */
16    public function __construct(string $name, string $field)
17    {
18        parent::__construct($name);
19        $this->setField($field);
20    }
21
22    /**
23     * Set the field for this aggregation.
24     *
25     * @param string $field the name of the document field on which to perform this aggregation
26     *
27     * @return $this
28     */
29    public function setField(string $field): self
30    {
31        return $this->setParam('field', $field);
32    }
33}
34