My solr details are as follows:
{ { "total_amount": 100, "created_at": "2015-07-08T18:30:00Z" }, { "total_amount": 200, "created_at": "2015-07-08T18:30:00Z" }, { "total_amount": 300, "created_at": "2015-06-08T18:30:00Z" }, { "total_amount": 400, "created_at": "2015-06-08T18:30:00Z" } }
I want to get the total_amount amount for the grouping month. So the output answer will be as follows:
{ "2015-07-01T00:00:00Z" : 300, "2015-06-01T00:00:00Z" : 700 }
I use the query below for this answer, but it only gives me the number of occurrences.
Request and response as follows:
{ "responseHeader": { "status": 0, "QTime": 2, "params": { "facet.date.start": "2015-04-01T00:00:00Z", "facet": "true", "fl": "created_at,total_amount", "q": "campaign_id:1", "facet.date": "created_at", "facet.date.gap": "+1MONTH", "wt": "json", "facet.date.end": "2015-09-01T00:00:00Z" } }, "response": { "numFound": 3, "start": 0, "docs": [ { "total_amount": 100, "created_at": "2015-07-08T18:30:00Z" }, { "total_amount": 100, "created_at": "2015-07-08T18:30:00Z" }, { "total_amount": 100, "created_at": "2015-07-08T18:30:00Z" } ] }, "facet_counts": { "facet_queries": {}, "facet_fields": {}, "facet_dates": { "created_at": { "2015-04-01T00:00:00Z": 0, "2015-05-01T00:00:00Z": 0, "2015-06-01T00:00:00Z": 0, "2015-07-01T00:00:00Z": 3, "2015-08-01T00:00:00Z": 0, "gap": "+1MONTH", "start": "2015-04-01T00:00:00Z", "end": "2015-09-01T00:00:00Z" } }, "facet_ranges": {}, "facet_intervals": {}, "facet_heatmaps": {} } }