Also change manufacturedate_dt to dob field and price to grade... On Mon, Jun 5, 2017 at 10:33 AM, Susheel Kumar <susheel2...@gmail.com> wrote:
> You are looking for something like below. Please adjust the start and > end. You can also give a fixed date instead of NOW etc.. > > curl http://localhost:8983/solr/techproducts/query -d 'q=*:*& > > json.facet={ > > byyeaar:{ > > type:range, > > field:"manufacturedate_dt", > > start : NOW-15YEAR/YEAR, > > end : NOW/YEAR, > > gap : "%2B1YEAR", > > other : "before", > > facet:{ > > "metrics" : "sum(price)" > } > } > }' > > On Sun, Jun 4, 2017 at 6:57 AM, Mikhail Ibraheem < > arsenal2...@yahoo.com.invalid> wrote: > >> Hi,I have a date field date_of_birth and have double field grade. I can >> easily get the sum of grades per date_of_birth value >> using:{ date_of_birth:{ type:terms, >> field:"date_of_birth", facet: { "metric":"sum(grade)" } }} >> But what if I want to group only part of the date_of_birth? for example I >> want to get the sum of grade per year 2000? >> This doesn't work:{ date_of_birth:{ type:terms, >> field:date_of_birth/YEAR, facet: { "metric":"sum(grade)" } }} >> Please advise. >> Thanks > > >