Nested.php 719 B

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