Reputation: 81
I have a Solr index with fields :
STR(k_id)
STR(k_pid)
INT(k_count) >= 1
I want a query which achieves this :
SELECT k_pid, SUM(k_count) FROM index GROUP BY k_pid
How can I do the sum operation on the k_count field? Appreciate any help.
http://<myhost>:<port>/solr/collection2/select?q=*:*&debugQuery=true&fl=mk_pid,mk_id,mk_count&group=true&group.field=mk_pid
Upvotes: 3
Views: 7497
Reputation: 739
You can't execute sum operations with the field collapsing (group) feature.
Use the stats component for this purpose : http://wiki.apache.org/solr/StatsComponent
Upvotes: 4