Matrix sum of multi-valued field

14 views
Skip to first unread message

Oliver Mannion

unread,
Jan 13, 2015, 9:55:36 AM1/13/15
to helio...@googlegroups.com
Hi,

If I have documents with a multi-valued field of doubles, eg:

{
 levels: [0, 0.1, 2, 2.2]
}

{
levels: [1, 1.1, 3, 4]
}

Is it possible to do a matrix sum of  the levels field, eg: summing each individual value with other values in the same position to get

sumLevels: [1, 1.2, 5, 6.2]

If not, then I will have to consider the alternative of breaking the levels multi-valued field into separate fields (however the number of values is not fixed), or documents (would work, but will be a lot more documents).

Regards,
Oliver

Yonik Seeley

unread,
Jan 17, 2015, 8:09:32 PM1/17/15
to helio...@googlegroups.com
Yeah, I think the only way to do this currently is to use multiple fields.

level_1_d : 1
level_2_d : 1.1
level_3_d : 3
level_4_d : 4

And then ask for sum(level_1_d), etc...

-Yonik
http://heliosearch.org - native code faceting, facet functions,
sub-facets, off-heap data
Reply all
Reply to author
Forward
0 new messages