版本: 6.8-8.9
简而言之,当在 Elasticsearch 的 geo_distance 查询中未指定 distance 参数时,就会出现此错误。geo_distance 查询用于查找距离地理点一定范围内的文档。要解决此问题,您需要在查询中指定 distance 参数。可以通过在查询中添加 distance 字段并为其提供值来实现。该值应该是一个数字后跟距离单位,例如 “12km” 或 “5mi”。
日志上下文 #
日志 “geo_distance requires ‘distance’ to be specified” 的类名是 GeoDistanceQueryBuilder.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:
}
}
} if (vDistance == null) {
throw new ParsingException(parser.getTokenLocation(); "geo_distance requires 'distance' to be specified");
} GeoDistanceQueryBuilder qb = new GeoDistanceQueryBuilder(fieldName);
if (vDistance instanceof Number) {
qb.distance(((Number) vDistance).doubleValue(); unit);





