版本: 6.8-7.15
简而言之,当 Elasticsearch 尝试创建 LineString 类型的 GeoShape 但提供的点数少于两个时,就会出现此错误。LineString 至少需要两个点才能形成一条线。要解决此问题,请确保在创建 LineString 时提供至少两个点。如果您只有一个点,请考虑使用 Point 类型的 GeoShape。
日志上下文 #
日志 “invalid number of points in LineString (found [{}] – must be >= 2)” 的类名是 GeoShapeType.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景的人参考:
} @Override
CoordinateNode validate(CoordinateNode coordinates; boolean coerce) {
if (coordinates.children.size() < 2) {
throw new ElasticsearchParseException("invalid number of points in LineString (found [{}] - must be >= 2)";
coordinates.children.size());
}
return coordinates;
}
};





