summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Aggregation/Cardinality.php
blob: 72b2e3aa7d79e48e52346adb255e4e59249c8183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace Elastica\Aggregation;

/**
 * Class Cardinality.
 *
 * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html
 */
class Cardinality extends AbstractSimpleAggregation
{
    /**
     * @param int $precisionThreshold
     *
     * @return $this
     */
    public function setPrecisionThreshold($precisionThreshold)
    {
        if (!is_int($precisionThreshold)) {
            throw new \InvalidArgumentException('precision_threshold only supports integer values');
        }

        return $this->setParam('precision_threshold', $precisionThreshold);
    }

    /**
     * @param bool $rehash
     *
     * @return $this
     */
    public function setRehash($rehash)
    {
        if (!is_bool($rehash)) {
            throw new \InvalidArgumentException('rehash only supports boolean values');
        }

        return $this->setParam('rehash', $rehash);
    }
}