Subhrajit
Subhrajit

Reputation: 75

How to count multiple fields with group by another field in solr

I have solr document which is like below.

agentId : 100
emailDeliveredDate : 2018-02-08,
emailSentDate : 2018-02-07
agentId : 100
emailSentDate : 2018-02-06
agentId : 101
emailDeliveredDate : 2018-02-08,
emailSentDate : 2018-02-07

I need a result like below.
agentId : 100
emailDeliveredDate : 1,
emailSentDate : 2
agentId : 101
emailDeliveredDate : 1,
emailSentDate : 1

In mysql it will be :
select count(emailDeliveredDate),count(emailSentDate) group by agentId;

I need help in solr for this.

Upvotes: 1

Views: 315

Answers (1)

Subhrajit
Subhrajit

Reputation: 75

I did not get any way in Solr which can help me. So I used facet with pivot which gave me half results. Rest half calculation I did in Java.

Upvotes: 1

Related Questions