try these

total sum of individual items:
/select?q=*:*&wt=json&indent=true&rows=0&json.facet={itemprice:{terms:{facet:{sum:"sum(price)"},field:item,limit:100,mincount:1}}}

sum of all the items:
/select?q=*:*&wt=json&indent=true&rows=0&json.facet={sum:"sum(price)"}



On Mon, Jul 27, 2015 at 6:12 PM, Vineeth Dasaraju <vineeth.ii...@gmail.com>
wrote:

> Hi,
>
> How can I get the sum of a particular field in the documents in solr?
>
> Eg:.
>
> [{"item": "ice cream",
> "price" : "345"},
> {"item": "snickers",
> "price" : "34"},
> {"item": "hersheys",
> "price" : "5"}]
>
> I want to get the total price for the items.
>
> Regards,
> Vineeth
>

Reply via email to