elasticsearch 聚合函数 max double精度损失bug
测试样例数据
{
"size" : 0,
"query" : {
"bool" : {
"must" : {
"bool" : {
"must" : {
"bool" : {
"must" : {
"match" : {
"cankwxzwtm" : {
"query" : "丹参",
"type" : "phrase"
}
}
}
}
}
}
}
}
},
"aggregations" : {
"group_docid" : {
"terms" : {
"field" : "docid.raw",
"size" : 1000
},
"aggregations" : {
"maxid" : {
"max" : {
"field" : "longId"
}
}
}
}
}
}
测试结果数据
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"failed": 0
},
"hits": {
"total": 24,
"max_score": 0,
"hits": []
},
"aggregations": {
"group_docid": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "995922987708317699",
"doc_count": 4,
"maxid": {
"value": 995922987708317700
}
},
{
"key": "995922987708317703",
"doc_count": 2,
"maxid": {
"value": 995922987708317700
}
},
{
"key": "995922987708317708",
"doc_count": 2,
"maxid": {
"value": 995922987708317700
}
},
{
"key": "995922987712512006",
"doc_count": 2,
"maxid": {
"value": 995922987712512000
}
},
{
"key": "995922987712512012",
"doc_count": 2,
"maxid": {
"value": 995922987712512000
}
},
{
"key": "995922987704123392",
"doc_count": 1,
"maxid": {
"value": 995922987704123390
}
},
{
"key": "995922987708317700",
"doc_count": 1,
"maxid": {
"value": 995922987708317700
}
},
{
"key": "995922987708317701",
"doc_count": 1,
"maxid": {
"value": 995922987708317700
}
},
{
"key": "995922987708317704",
"doc_count": 1,
"maxid": {
"value": 995922987708317700
}
},
{
"key": "995922987708317705",
"doc_count": 1,
"maxid": {
"value": 995922987708317700
}
},
{
"key": "995922987708317706",
"doc_count": 1,
"maxid": {
"value": 995922987708317700
}
},
{
"key": "995922987708317709",
"doc_count": 1,
"maxid": {
"value": 995922987708317700
}
},
{
"key": "995922987712512002",
"doc_count": 1,
"maxid": {
"value": 995922987712512000
}
},
{
"key": "995922987712512007",
"doc_count": 1,
"maxid": {
"value": 995922987712512000
}
},
{
"key": "995922987712512009",
"doc_count": 1,
"maxid": {
"value": 995922987712512000
}
},
{
"key": "995922987712512010",
"doc_count": 1,
"maxid": {
"value": 995922987712512000
}
},
{
"key": "995922987712512011",
"doc_count": 1,
"maxid": {
"value": 995922987712512000
}
}
]
}
}
}
总结:maxid.value的值精度已经损失,没去官网深究原因,用terms替换max方法,得出所有id值,手动筛选值。
elasticsearch 聚合函数 max double精度损失bug的更多相关文章
- js double 精度损失 bugs
js double 精度损失 bugs const arr = [ 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01 ]; // [ ...
- js 小数转整数,避免精度损失 bug
js 小数转整数,避免精度损失 bug const arr = [ 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01 ]; // ( ...
- java 常用类库:BigInteger大整数;BigDecimal大小数(解决double精度损失);
大整数BigInteger package com.zmd.common_class_libraries; import java.math.BigInteger; /** * @ClassName ...
- Java中关于 BigDecimal 的一个导致double精度损失的"bug"
背景 在博客 恶心的0.5四舍五入问题 一文中看到一个关于 0.5 不能正确的四舍五入的问题.主要说的是 double 转换到 BigDecimal 后,进行四舍五入得不到正确的结果: public ...
- GROUP BY 聚合函数(max min sum avg count) 和HAVING的 使用
重新复习一下这个都源自于我经常需要查的一个需求 “要找到表里面 出现了两次或者三次的某个字段” 现在假设有一张表字段是 +----+---------------------+------------ ...
- elasticsearch聚合函数
计算每个tag下的商品数量 GET /ecommerce/product/_search { "aggs": { //聚合 "group_by_tags": ...
- ElasticSearch 聚合函数
一.简单聚合 桶 :简单来说就是满足特定条件的文档的集合. 指标:大多数 指标 是简单的数学运算(例如最小值.平均值.最大值,还有汇总),这些是通过文档的值来计算. 桶能让我们划分文档到有意义的集合, ...
- oracle中的常用函数、字符串函数、数值类型函数、日期函数,聚合函数。
一.字符串的常用函数. --一.oracle 字符串常用函数 --1. concat 连接字符串的函数,只能连接[两个]字符串. 字符写在括号中,并用逗号隔开! --2."||"符 ...
- 第17课-数据库开发及ado.net 聚合函数,模糊查询like,通配符.空值处理.order by排序.分组group by-having.类型转换-cast,Convert.union all; Select 列 into 新表;字符串函数;日期函数
第17课-数据库开发及ado.net 聚合函数,模糊查询like,通配符.空值处理.order by排序.分组group by-having.类型转换-cast,Convert.union all; ...
随机推荐
- 【MySQL】5.6.x InnoDB Error Table mysql.innodb_table_stats not found
[问题描述]: 检查error log的时候发现大量warnings: [Warning] InnoDB Error Table mysql.innodb_index_stats not found ...
- WebService远程调用技术
1.---------------------------------介绍-------------------------------------------------- (1)远程调用:一个系统 ...
- springmvc实现json交互 -requestBody和responseBody
json数据交互 1.为什么要进行json数据交互 json数据格式在接口调用中.html页面中较常用,json格式比较简单,解析还比较方便. 比如:webservice接口,传输json数据. 2. ...
- ubuntu discuz 该函数需要 PHP 支持 XML。请联系空间商,确定开启了此项功能
apt-get install php-xml apt-get install php-xml-parser
- Java中的方法重载
一.什么是方法重载? 方法重载就是两个或多个方法的方法名相同,但是方法的形参类型,数量,顺序不同. 上面提到的三点也就是一个方法的特征标,只要有一点不相同,则该方法就不相同,就可以实现重载. 在这里的 ...
- skflow 分类与回归接口API 简单测试
skflow也即是 tf.contrib.learn, 是 TensorFlow 官方提供的另外一个对 TensorFlow 的高层封装,通过这个封装,用户可以和使用 sklearn 类似的方法使用 ...
- Web form ajax请求
1.添加web应用程序 2.添加web窗体 web窗体Demo <%@ Page Language="C#" AutoEventWireup="true" ...
- 人工智能之KNN算法
转载自:https://www.cnblogs.com/magic-girl/p/python-kNN.html 基于python实现的KNN算法 邻近算法(k-NearestNeighbor) 是机 ...
- Python 模块管理1
Python 模块管理 导入新的模块 创建一个 calculate.py 文件 print('ok') def add(x,y): return x + y def sub(x,y): retur ...
- Blender的单位:一图弄懂Blender的单位
1设置单位,在右边的场景设置里,可以设置公制,英制.下面还可以设置基础单位长度,就是单位网格对应的长度. 2显示单位,按N出现在右边的属性栏里,可以设置选中的显示长度及角度. 3测量,按T出现在左边d ...