nested facets
in elastic we can do complex nested facet groups such as
"aggs": {
"resellers": {
"nested": {
"path": "resellers"
},
"aggs": {
"min_price": {
"min": {
"field": "resellers.price"
}
}
}
}
}
It would be nice to see the same functionality in atlas search
-
Roy commented
Apache Solr also implements nested facets via its [JSON Facet API](https://solr.apache.org/guide/solr/latest/query-guide/json-facet-api.html#nested-facets). A similar syntax in Atlas Search could look like this:
```js
[{
"$searchMeta": {
"facet": {
"operator": {
"text": {
"path": "title",
"query": "space"
}
},
"facets": {
"genresFacet": {
"type": "string",
"path": "genres",
"facets": {
"yearFacet": {
"type": "number",
"path": "year",
"boundaries": [1990, 2000, 2010, 2020]
}
}
}
}
}
}
}]
```... and the output could look like this:
```js
{
"count": {
"lowerBound": NumberLong(23026)
},
"facet": {
"genresFacet": {
"buckets": [
{
"_id": "Drama", "count": NumberLong(13527),
"yearFacet": {
"buckets": [
{ "_id": 1990, "count": NumberLong(23) },
{ "_id": 2000, "count": NumberLong(89) },
{ "_id": 2010, "count": NumberLong(308) }
]
}
},
{
"_id": "Comedy", "count": NumberLong(6922),
"yearFacet": {
"buckets": [
{ "_id": 2010, "count": NumberLong(13) },
{ "_id": 2020, "count": NumberLong(28) }
]
}
}
]
}
}
}
```