Cardinality.php 953 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Elastica\Aggregation;
  3. /**
  4. * Class Cardinality.
  5. *
  6. * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html
  7. */
  8. class Cardinality extends AbstractSimpleAggregation
  9. {
  10. /**
  11. * @param int $precisionThreshold
  12. *
  13. * @return $this
  14. */
  15. public function setPrecisionThreshold($precisionThreshold)
  16. {
  17. if (!is_int($precisionThreshold)) {
  18. throw new \InvalidArgumentException('precision_threshold only supports integer values');
  19. }
  20. return $this->setParam('precision_threshold', $precisionThreshold);
  21. }
  22. /**
  23. * @param bool $rehash
  24. *
  25. * @return $this
  26. */
  27. public function setRehash($rehash)
  28. {
  29. if (!is_bool($rehash)) {
  30. throw new \InvalidArgumentException('rehash only supports boolean values');
  31. }
  32. return $this->setParam('rehash', $rehash);
  33. }
  34. }