分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 教程案例

solrcloud jsonfacet分组聚合 unique计数不准确

发布时间:2023-09-06 02:17责任编辑:熊小新关键词:jsjson

jsonfacet分组聚合查询

unique、hll函数问题

对不同的值进行估算,并非准确的值,

优点:节省内存消耗,用分组算法对不同的值count进行估算

缺点:无法准确统计count(distinct key)

区别:

unique给定字段的惟一值的数量。超过100个值,它不会产生精确的估计,惟一的facet函数是Solr最快速的实现来计算不同值的数量

hll通过超log-log算法的分布式基数估计

记录:

json.facet={fz:{type:terms,field:khid,refine:true,overrequest:100000,limit:10,facet:{summy:"sum(my)",sumcnt:"hll(posid)"}}}&fq=month:(201808)

json.facet={fz:{type:terms,field:khid,refine:true,overrequest:100000,limit:10,facet:{summy:"sum(my)",sumcnt:"unique(posid)"}}}&fq=month:(201808)

计算出的sumcnt是估算,而不是精确计数

hll函数比unqie函数估算的准确些,但都不精确

解决方法:

1、用stats语法对count(distinct)统计

stats=true&stats.field={!countDistinct=true}posid&fq=month:(201808)

精确统计,对所有节点的数据进行全面统计,耗时高,吃内存

2、dv函数解决

&indent=on&json.facet={fz:{terms:{field:posid,method:dv,limit:1000000}}}

solrcloud jsonfacet分组聚合 unique计数不准确

原文地址:https://www.cnblogs.com/FangMingHuan/p/9761612.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved