版本: 7.2-8.9
简而言之,当 Elasticsearch 尝试在 geo_shape 字段中使用少于两个点创建线串时,会出现此错误。线串至少需要两个点才能形成一条线。要解决此问题,请确保在创建线串时提供至少两个点。或者,如果只需要一个位置,可以将形状类型更改为点。此外,请检查数据源中是否有任何缺失或空值导致此问题。
日志上下文 #
日志"not enough points to build a line"的类名是 GeoJson.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景信息的人参考:
if (coordinate != null) {
throw new ElasticsearchException("expected a list of points but got a point");
} if (children.size() < 2) {
throw new ElasticsearchException("not enough points to build a line");
}
boolean needsClosing;
int resultSize;
if (close && coerce && children.get(0).asPoint().equals(children.get(children.size() - 1).asPoint()) == false) {





