$_name
$_name : string
Class ScriptedMetric.
This function can be used to handle params for queries, filter
__construct(string $name, string|null $initScript = null, string|null $mapScript = null, string|null $combineScript = null, string|null $reduceScript = null)
string | $name | the name if this aggregation |
string|null | $initScript | Executed prior to any collection of documents |
string|null | $mapScript | Executed once per document collected |
string|null | $combineScript | Executed once on each shard after document collection is complete |
string|null | $reduceScript | Executed once on the coordinating node after all shards have returned their results |
addAggregation(\Elastica\Aggregation\AbstractAggregation $aggregation) : $this
Add a sub-aggregation.
\Elastica\Aggregation\AbstractAggregation | $aggregation |
setCombineScript(string $script) : $this
Executed once on each shard after document collection is complete.
Allows the aggregation to consolidate the state returned from each shard. If a combine_script is not provided the combine phase will return the aggregation variable.
string | $script |
setReduceScript(string $script) : $this
Executed once on the coordinating node after all shards have returned their results.
The script is provided with access to a variable _aggs which is an array of the result of the combine_script on each shard. If a reduce_script is not provided the reduce phase will return the _aggs variable.
string | $script |