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

版本: 6.8-7.7

简而言之,当你尝试对不支持 sampler 聚合的字段类型应用该聚合时,就会发生此错误。Sampler 聚合用于选择文档子集,但并非所有字段类型都兼容。要解决此问题,你可以将字段类型更改为支持 sampler 聚合的类型,或者使用与当前字段类型兼容的其他类型的聚合。或者,你可以创建一个具有兼容类型的新字段,并将值从原始字段复制过来。

日志上下文 #

日志 “Sampler aggregation cannot be applied to field [” 的类名是 DiversifiedAggregatorFactory.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

}
 return execution.create(name; factories; shardSize; maxDocsPerValue; valuesSource; searchContext; parent; pipelineAggregators;
 metaData);
 }  throw new AggregationExecutionException("Sampler aggregation cannot be applied to field [" + config.fieldContext().field()
 + "]. It can only be applied to numeric or string fields.");
 }  @Override
 protected Aggregator createUnmapped(SearchContext searchContext;