blob: af7c1940db893f201894ec2a70c16ad6fa45c4a6 (
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
|
<?php
namespace Elastica\Aggregation;
use Elastica\Script;
abstract class AbstractSimpleAggregation extends AbstractAggregation
{
/**
* Set the field for this aggregation
* @param string $field the name of the document field on which to perform this aggregation
* @return AbstractSimpleAggregation
*/
public function setField($field)
{
return $this->setParam('field', $field);
}
/**
* Set a script for this aggregation
* @param string|Script $script
* @return AbstractSimpleAggregation
*/
public function setScript($script)
{
if ($script instanceof Script) {
$this->setParam('params', $script->getParams());
$script = $script->getScript();
}
return $this->setParam('script', $script);
}
}
|