Skip to content

Comments

优化 Terms Agg 的 limit 设置逻辑,修复范围查询 IP 类型和时间类型转换的问题#90

Open
zat366 wants to merge 2 commits intoTongchengOpenSource:mainfrom
zat366:aggslimit
Open

优化 Terms Agg 的 limit 设置逻辑,修复范围查询 IP 类型和时间类型转换的问题#90
zat366 wants to merge 2 commits intoTongchengOpenSource:mainfrom
zat366:aggslimit

Conversation

@zat366
Copy link

@zat366 zat366 commented Aug 25, 2025

feat(聚合策略): 优化 Terms Agg 的 limit 设置逻辑

  • 扩展了对子聚合为空情况的处理,增加了对特殊聚合组合的处理
  • 引入了对 maxResultRow 的考虑,以确保数据完整性
  • 优化了 limit 的设置逻辑,提高了查询结果的准确性

fix(range): 修复范围查询 IP 类型和时间类型转换的问题- 优化 IP 类型判断逻辑,优先使用 low 值判断,low 为 null 时使用 high 值

  • 修复时间类型范围查询的上界比较运算符错误

zat366 added 2 commits August 21, 2025 19:12
- 扩展了对子聚合为空情况的处理,增加了对特殊聚合组合的处理
- 引入了对 maxResultRow 的考虑,以确保数据完整性
- 优化了 limit 的设置逻辑,提高了查询结果的准确性
linger000

This comment was marked as duplicate.

@zat366
Copy link
Author

zat366 commented Aug 26, 2025

建议还原113行判断逻辑,改回原逻辑if (isSubAggGroupByEmpty()) 若有子聚合场景,ck limit size条件会导致子聚合数据缺失

在我们一个特殊场景聚合时,如果不做groupby 会有报错超过 maxResultRow

聚合语句是

"aggs": {
    "2": {
      "terms": {
        "field": "client_ip",
        "order": {
          "_count": "desc"
        },
        "size": 20
      },
      "aggs": {
        "3": {
          "terms": {
            "field": "status",
            "order": {
              "_count": "desc"
            },
            "size": 5
          }
        }
      }
    }
  }

所以对这个特殊场景做了limit 限制

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants