running this with group=true will give you the sum per type, with
group=false (or without any mention of "group") you'll get the total sum.

On Thu, Feb 5, 2015 at 4:59 PM, Kiril Stankov <ki...@open-net.biz> wrote:

> Hi,
>
> I want to get the sum of values from all results, produced by the map
> function.
> Something like this:
>
> |||  "|map|":|"function(doc) {\n  emit(doc.type, doc.total);\n}"|,
>  "|reduce|":|"_sum"||||
>
>
> Running this gives me sum per 'doc.type'.
> I wonder if I can get the sum easily for all 'doc.total' values across all
> documents, while still keeping the type as key for the map.
>
> Thanks in advance!
> ------------------------------------------------------------------------
> *With best regards,*
> Kiril Stankov
>
> On 2/4/2015 2:37 AM, Ayhan Kesenci wrote:
>
>> I export a view with a curl command
>>
>> and the view looks like this in the map
>>
>> function(doc) {
>> emit([doc.user.friends_count,
>> doc.user.followers_count,doc.retweet_count,doc.text], doc.id_str);
>> }
>>
>>
>> is it possible to surround the for example doc.user.friends_count with
>> quote signs, to have it like this with the usual comma between the quote
>> signs?
>>
>>
>> "doc.user.friends_count","
>> doc.user.followers_count","doc.retweet_count","doc.text"
>>
>> thank you
>>
>> 2015-02-04 1:31 GMT+01:00 Ayhan Kesenci <a.kesenc...@googlemail.com>:
>>
>>  I export a view with a curl command
>>>
>>> and the view looks like this in the map
>>>
>>> function(doc) {
>>> emit([doc.user.friends_count,
>>> doc.user.followers_count,doc.retweet_count,doc.text], doc.id_str);
>>> }
>>>
>>>
>>> is it possible to surround the for example doc.user.friends_count with
>>> quote signs, to have it like this with the usual comma between the quote
>>> signs?
>>>
>>>
>>> "doc.user.friends_count","
>>> doc.user.followers_count","doc.retweet_count","doc.text"
>>>
>>>
>>>
>

Reply via email to