Completed
Push — master ( 542835...98e5e9 )
by Nicolas
02:13
created

DiversifiedSampler::setExecutionHint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Elastica\Aggregation;
4
5
/**
6
 * Class DiversifiedSampler.
7
 *
8
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-diversified-sampler-aggregation.html
9
 */
10
class DiversifiedSampler extends AbstractSimpleAggregation
11
{
12
    /**
13
     * Set the number of top-scoring documents to be returned from each shard.
14
     *
15
     * @return $this
16
     */
17
    public function setShardSize(int $shardSize): self
18
    {
19
        return $this->setParam('shard_size', $shardSize);
20
    }
21
22
    /**
23
     * Set the maximum number of documents to be returned per value.
24
     *
25
     * @return $this
26
     */
27
    public function setMaxDocsPerValue(int $max): self
28
    {
29
        return $this->setParam('max_docs_per_value', $max);
30
    }
31
32
    /**
33
     * Instruct Elasticsearch to use direct field data or ordinals/hashes of the field values to execute this aggregation.
34
     * The execution hint will be ignored if it is not applicable.
35
     *
36
     * @return $this
37
     */
38
    public function setExecutionHint(string $hint): self
39
    {
40
        return $this->setParam('execution_hint', $hint);
41
    }
42
}
43