测试样例数据
{
"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的更多相关文章

  1. 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 ]; // [ ...

  2. 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 ]; // ( ...

  3. java 常用类库:BigInteger大整数;BigDecimal大小数(解决double精度损失);

    大整数BigInteger package com.zmd.common_class_libraries; import java.math.BigInteger; /** * @ClassName ...

  4. Java中关于 BigDecimal 的一个导致double精度损失的"bug"

    背景 在博客 恶心的0.5四舍五入问题 一文中看到一个关于 0.5 不能正确的四舍五入的问题.主要说的是 double 转换到 BigDecimal 后,进行四舍五入得不到正确的结果: public ...

  5. GROUP BY 聚合函数(max min sum avg count) 和HAVING的 使用

    重新复习一下这个都源自于我经常需要查的一个需求 “要找到表里面 出现了两次或者三次的某个字段” 现在假设有一张表字段是 +----+---------------------+------------ ...

  6. elasticsearch聚合函数

    计算每个tag下的商品数量 GET /ecommerce/product/_search { "aggs": {  //聚合 "group_by_tags": ...

  7. ElasticSearch 聚合函数

    一.简单聚合 桶 :简单来说就是满足特定条件的文档的集合. 指标:大多数 指标 是简单的数学运算(例如最小值.平均值.最大值,还有汇总),这些是通过文档的值来计算. 桶能让我们划分文档到有意义的集合, ...

  8. oracle中的常用函数、字符串函数、数值类型函数、日期函数,聚合函数。

    一.字符串的常用函数. --一.oracle 字符串常用函数 --1. concat 连接字符串的函数,只能连接[两个]字符串. 字符写在括号中,并用逗号隔开! --2."||"符 ...

  9. 第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;  ...

随机推荐

  1. C# string 与 String的区别

    C# string 与 String的区别 The string type represents a string of Unicode characters. string is an alias ...

  2. 使用Chrome调试工具抢阿里云免费套餐

    活动地址如下: https://free.aliyun.com/ntms/free/experience/getTrial.html 首先打开地址,需要登录,登陆后看到如下页面: 选择个人免费套餐,这 ...

  3. JAVA中的Set

    Set中存放的是没有重复的数据,下说记录一下使用中的小细节. 1.HashSet 区分大小写: Set<String> set1 = new HashSet<String>() ...

  4. spring mvc EL ModelAndView的 Model 值 在jsp中不显示

    问题:spring mvc开发过程中, 经常会给model addAttribute, 然后通过EL在jsp中显示,比如 ${msg}, 但是有时候会出现jsp最后显示的还是${msg},而不是msg ...

  5. jsp-servlet(2)响应HTML文档-书籍管理系统

    基础知识预备:  目标: 构建一个书籍管理系统,实现以下功能. 功能: 1 图书信息查询,(查) 2 书籍管理:添加书籍 3 书籍管理:修改书籍信息 4 书籍管理:删除书籍 一.预备工作 Book{ ...

  6. [LeetCode&Python] Problem 389. Find the Difference

    Given two strings s and t which consist of only lowercase letters. String t is generated by random s ...

  7. Prime Test(POJ 1811)

    素数判定的模板题,运用米勒-罗宾素数判定,然后用Pollard_Rho法求出质因数.使用相应的模板即可,不过注意存储质因子的数组需要使用vector,并且使用long long类型存储,不然存储不下, ...

  8. Hadoop错误:java.io.IOException: Incompatible clusterIDs

    问题: 配置Hadoop集群时,一个节点的DataNode无法启动 排查: 查看hadoop-root-datanode-bigdata114.log文件,错误信息如下: java.io.IOExce ...

  9. lucene随笔 IKAnalyzer StandardAnalyzer

    StandardAnalyzer 是单词分词器: String msg = "我喜欢你,我的祖国!china 中国,I love you!中华人民共和国"; 分词后的结果:[我], ...

  10. Python学习之---Python中的内置函数(方法)(更新中。。。)

    add(item)   #将item添加到s中,如果item已经在s中,则无任何效果 break        #退出循环,不会再运行循环中余下的代码 bool()     #将参数转换为布尔型 by ...