1<?php
2
3namespace Elastica\Aggregation;
4
5/**
6 * Class Nested.
7 *
8 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-nested-aggregation.html
9 */
10class Nested extends AbstractAggregation
11{
12    /**
13     * @param string $name the name of this aggregation
14     * @param string $path the nested path for this aggregation
15     */
16    public function __construct(string $name, string $path)
17    {
18        parent::__construct($name);
19        $this->setPath($path);
20    }
21
22    /**
23     * Set the nested path for this aggregation.
24     *
25     * @return $this
26     */
27    public function setPath(string $path): self
28    {
29        return $this->setParam('path', $path);
30    }
31}
32