Skip to content

Add script as an option to the 'sum' function

Latest
Compare
Choose a tag to compare
@ShisunXia ShisunXia released this 03 Sep 19:28
· 2 commits to master since this release

Added script as the 4th parameter to the 'sum' function. Now, it is possible to perform more complexed operations on the sum function. For example, we can do the following:
Item::es()->aggregate('Value', function($q) {
$q->sum('', null, null, ['source' => 'doc.price.value * doc.quantity.value'])->groupBy('status');
})->get()->aggregations();