lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Susheel Kumar <susheel2...@gmail.com>
Subject Re: Function queries with Json facet
Date Mon, 05 Jun 2017 14:33:54 GMT
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 <
arsenal2025@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message