summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Aggregation/Cardinality.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Aggregation/Cardinality.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Aggregation/Cardinality.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Aggregation/Cardinality.php b/vendor/ruflin/elastica/lib/Elastica/Aggregation/Cardinality.php
new file mode 100644
index 00000000..72b2e3aa
--- /dev/null
+++ b/vendor/ruflin/elastica/lib/Elastica/Aggregation/Cardinality.php
@@ -0,0 +1,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);
+ }
+}