diff options
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractSimpleAggregation.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractSimpleAggregation.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractSimpleAggregation.php b/vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractSimpleAggregation.php new file mode 100644 index 00000000..af7c1940 --- /dev/null +++ b/vendor/ruflin/elastica/lib/Elastica/Aggregation/AbstractSimpleAggregation.php @@ -0,0 +1,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); + } +}
\ No newline at end of file |