Django ElasticSearch DSL DRF 聚合

Django ElasticSearch DSL DRF aggregations

向 Django ElasticSearch DSL DRF 添加聚合的正确方法是什么?代码库包含一些空过滤器后端

https://github.com/barseghyanartur/django-elasticsearch-dsl-drf/tree/a2be5842e36a102ad66988f5c74dec984c31c89b/src/django_elasticsearch_dsl_drf/filter_backends/aggregations

我应该创建自定义后端还是有办法将它们直接添加到我的视图集中?

特别是,我想计算特定方面中所有结果的 IntegerField 总和。

Elasticsearch 有不止一种类型的聚合。 django-elasticsearch-dsl-drf 中的简单聚合在 FacetedSearchFilterBackend. Read the docs 中实现,或者只是 运行 示例项目到 运行 实验。