SUM_EACH([MAX VALUES, ]GROUP, VALUE)
MAX VALUES:The maximum number of entries that can be counted (default: 2,147,483,647). Beyond that, entries will be discarded. In some cases, depending on the data distribution, discarding groups via
MAX VALUESmay cause some data to be discarded from groups that would otherwise have been returned.
MAX VALUESis optional. If it is omitted there is, in effect, no limit.
GROUP:The field you would like counted.
VALUE:The field that is summed.
SUM_EACHcan be used only with hierarchical output types.
SUM_EACHreturns a mapping of the key value where the key is the
GROUP, and the value is the summation of the
VALUEfield over all the entries that have the same
GROUPkey. In the example below, all the "scores" for each "user" key are summed.