【发布时间】:2022-01-17 04:15:57
【问题描述】:
一个看似很琐碎的问题,促使我今天又勤奋地阅读了 Elasticsearch 文档。但是,到目前为止,我还没有遇到解决方案....
问题:
有没有一种简单的方法来设置过滤器聚合的 doc_count 与总 doc_count 的关系?
这是我的 search-request-json 中的一个 sn-p。
在
feature_occurrences
聚合中,我过滤了文档。
现在我想计算每个时间段中过滤/所有文档的比率。
GET my_index/_search
{
"aggs": {
"time_buckets": {
"date_histogram": {
"field": "date",
"calendar_interval": "1d",
"min_doc_count": 0
},
"aggs": {
"feature_occurrences": {
"filter": {
"term": {
"x": "y"
}
}
},
"feature_occurrences_per_doc" : {
// feature_occurences.doc_count / doc_count
}
有什么想法吗?