I posted same question on stackoverflow, but would like posting here as well.
By dynamic aggregation I means, the aggregation buckets are different per search query. Take ebay as example, if search for "iphone" https://www.ebay.com/sch/i.html?_from=R40&_trksid=p2380057.m570.l1313.TR12.TRC2.A0.H0.Xiphone.TRS0&_nkw=iphone&_sacat=0
The aggregations in left panel are:
- Features
- Network
- Model
- Color
- etc ...
But if search for Book, https://www.ebay.com/sch/i.html?_from=R40&_trksid=p2380057.m570.l1313.TR12.TRC2.A0.H0.Xbook.TRS0&_nkw=book&_sacat=0
The aggregations are:
- Guaranteed Delivery
- Condition
- Price
- Buying Format
- etc...
One possible approach is to define same aggregation fields for all documents, and when querying, pass all aggregation fields to query DSL.
But it is so heavy and not flexible.
Is there any simple solutions?