Skip to content
Snippets Groups Projects
Commit 52525e18 authored by Mantas Jonušas's avatar Mantas Jonušas
Browse files

Updated extended stats aggregation

parent c76eb4c7
No related branches found
No related tags found
No related merge requests found
......@@ -56,19 +56,16 @@ class ExtendedStatsAggregation extends AbstractAggregation
*/
public function getArray()
{
$out = [];
if ($this->getField()) {
$out['field'] = $this->getField();
} elseif ($this->getScript()) {
$out['script'] = $this->getScript();
} else {
throw new \LogicException('Extended stats aggregation must have field or script set.');
}
if ($this->getSigma()) {
$out['sigma'] = $this->getSigma();
}
$out = array_filter(
[
'field' => $this->getField(),
'script' => $this->getScript(),
'sigma' => $this->getSigma(),
],
function ($val) {
return ($val || is_numeric($val));
}
);
return $out;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment