Reputation: 338406
I want create a nested date range facet that has buckets by year, month, and day.
A query like this for a hard-coded date range (e.g. between 2020 to 2022)
{
"q": "*:*",
"start": 0,
"rows": 0,
"json.facet": {
"year": {
"type": "range",
"field": "archiveDate",
"sort": "archiveDate asc",
"start": "2020-01-01T00:00:00Z",
"end": "2023-01-01T00:00:00Z",
"gap": "/YEAR+1YEAR",
"facet": {
"month": {
"type": "range",
"field": "archiveDate",
"sort": "archiveDate asc",
"start": "2020-01-01T00:00:00Z",
"end": "2023-01-01T00:00:00Z",
"gap": "/MONTH+1MONTH",
"facet": {
"day": {
"type": "range",
"field": "archiveDate",
"sort": "archiveDate asc",
"start": "2020-01-01T00:00:00Z",
"end": "2023-01-01T00:00:00Z",
"gap": "/DAY+1DAY"
}
}
}
}
}
}
}
works, but it takes a while, and returns way too many buckets for the "month" and "day" facets - most of them zero, because they are outside of the parent range.
Is there a way to restrict the "start" and "end" of the nested facets to their respective parents?
The Solr version in question is 7.2.
Upvotes: 1
Views: 256