Skip to content
Snippets Groups Projects
Commit da6f4a6e authored by Simonas Šerlinskas's avatar Simonas Šerlinskas
Browse files

Merge pull request #321 from chyzas/patch-extended-stats-aggregation

Updated extended stats aggregation
parents 97c8881f 52525e18
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