CouchDB _approx_count_distinct

问题描述 投票:0回答:1

我在使用

_approx_count_distinct reduce function
时遇到问题。根据文档 _approx_count_distinct 松散地基于 Hyperloglog 算法。

我无法让它工作。

五月地图功能:

function (doc) {
  if (doc.folder && doc.from && doc.created) {
    var splitted = doc.from.split("#");
    var address = splitted[splitted.length-1];
    emit([doc.folder, address,doc.created], 1);
  }
}

这是我想要做的查询:

curl http://localhost:5984/mydb?startkey=['sent', 'abc', 0]&endkey=['sent', 'abc, 1709676004000]&group_level=3

我总是获得所有行(未按“已发送”文件夹过滤)。由于缺乏对 _approx_count_distinct 减速器内部工作原理的理解,我在这里做了一些根本性错误的事情。

有没有正确思考这个问题的方法?

我正在尝试计数..就这么简单。

couchdb hyperloglog
1个回答
0
投票

我遇到的问题是 URL 格式不正确(尽管可执行)。

解决方案是将我的查询添加到 Postman 中,并查看格式化的curl命令对应的 URL 编码。

© www.soinside.com 2019 - 2024. All rights reserved.