I have created my own customised FacetedSearch
class using Pythons Elasticsearch DSL library to perform search with additional filtering in def search(self)
. Now I would like to reuse my class to do some statistical aggregations. To stay DRY I want to reuse this class and for performance reason I would like to temporarily disable facets calculation when they are not necessary while preserving all the filtering. So question is how can I temporarily omit facets in FacetedSearch
search?
So you just want to use the Search
object's query, but not it's aggregations? In that case just call the object's search()
method to get the Search
object and go from there.
If you want the aggregations, but just want to skip the python-level facets
calculation just use the build_search
method to get the raw Search
object including the aggregations.