summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Aggregation/ValueCount.php
blob: 36fb2a2c6b713b6b203f03eb1f9df963fd65bccc (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
<?php

namespace Elastica\Aggregation;

/**
 * Class ValueCount
 * @package Elastica\Aggregation
 * @link http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-aggregations-metrics-valuecount-aggregation.html
 */
class ValueCount extends AbstractAggregation
{
    /**
     * @param string $name the name of this aggregation
     * @param string $field the field on which to perform this aggregation
     */
    public function __construct($name, $field)
    {
        parent::__construct($name);
        $this->setField($field);
    }

    /**
     * Set the field for this aggregation
     * @param string $field the name of the document field on which to perform this aggregation
     * @return ValueCount
     */
    public function setField($field)
    {
        return $this->setParam('field', $field);
    }
}