📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 7.3-7.7

简而言之,当您在 Elasticsearch 中对浮点类型的字段尝试使用 RareTerms 聚合时,会出现此错误。RareTerms 聚合专为处理离散值而设计,不支持连续值。要解决此问题,如果可能的话,您可以将字段类型更改为非浮点类型,或者使用支持浮点字段的其他聚合类型,例如 Histogram 或 Percentiles。此外,如果精度不是关键因素,您还可以在索引之前将浮点值四舍五入为整数。

日志上下文

日志 “RareTerms aggregation does not support floating point fields.” 的类名是 RareTermsAggregatorFactory.java。 我们从 Elasticsearch 源代码中提取了以下内容,为寻求深入上下文的用户提供了参考:

    }  if (valuesSource instanceof ValuesSource.Numeric) {
        IncludeExclude.LongFilter longFilter = null;
        if (((ValuesSource.Numeric) valuesSource).isFloatingPoint()) {
            throw new AggregationExecutionException("RareTerms aggregation does not support floating point fields.");
        }
        if (includeExclude != null) {
            longFilter = includeExclude.convertToLongFilter(config.format());
        }
        return new LongRareTermsAggregator(name; factories; (ValuesSource.Numeric) valuesSource; config.format();
查看 Markdown
On this page