测试样例数据
{
"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. DRF-Rest_Framework 学习文档

    序列化器(serializer) 定义Serializer 1. 定义方法 Django REST framework中的Serializer使用类来定义,须继承自rest_framework.ser ...

  2. 实验楼 Linux 基础入门(新版)挑战:寻找文件

    传送门:https://www.shiyanlou.com/courses/running 挑战:寻找文件 实验环境: 用户名:shiyanlou 密码:76036575 寻找文件 介绍 有一个非常重 ...

  3. 2.19 cookie相关操作

    2.19 cookie相关操作 前言虽然cookie相关操作在平常ui自动化中用得少,偶尔也会用到,比如登录有图形验证码,可以通过绕过验证码方式,添加cookie方法登录.登录后换账号登录时候,也可作 ...

  4. MySQL添加可重复执行列

    一.information_schema数据库表说明: SCHEMATA表:提供了当前mysql实例中所有数据库的信息.是show databases的结果取之此表. TABLES表:提供了关于数据库 ...

  5. matlab一行太长

    太长了,一行写不下,所以用...接下一行 例子: x=[ mvnrnd( mu_real(:,1) , cov_real(:,:,1) , round(N*a_real(1)) )' ,... mvn ...

  6. Buildroot stress-ng Linux系统压力测试

    /********************************************************************** * Buildroot stress-ng Linux系 ...

  7. Java中的面向对象I

    一.首先来了解一下Java面向对象的五个程序设计方式: 1.万物皆对象 Java以类为基本模块来将问题抽象化,在计算机中解决实际生活中的问题 2.程序为对象的集合,程序中的类通过互发消息来告知彼此要做 ...

  8. exception in thread "http-apr-80-exec-24" java.lang.OutOfMemoryError:PermGen...

    今天客户说项目访问不了了,我急忙看了下告警,发现上报:“exception in thread "http-apr-80-exec-24" java.lang.OutOfMemor ...

  9. MySQL 5.7--多源复制(非GTID模式)

    ==================================================== 在MYSQL5.7版本中引入多源复制,一个从库允许复制多个主库的数据,每个主库被配置为一个单独 ...

  10. Bow & Arrow 学习

    using UnityEngine; using System.Collections; using System.Collections.Generic; using UnityEngine.UI; ...