版本: 8.2-8.2
简而言之,当您尝试在Elasticsearch中索引的GeoJSON对象的’coordinates’字段没有至少两个值时,就会发生此错误。GeoJSON对象需要至少两个坐标(纬度和经度)来定义空间中的点。要解决此问题,请确保您的GeoJSON对象至少有两个坐标。如果数据来自外部源,请在索引之前进行验证。如果您正在生成数据,请检查生成逻辑以确保其生成有效的GeoJSON。
日志上下文 #
日志"GeoJSON ‘coordinates’ must contain at least two values"的类名是 GeoUtils.java. 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考:
if (coordinates != null) {
if (geojsonType == null || geojsonType.toLowerCase(Locale.ROOT).equals("point") == false) {
throw new ElasticsearchParseException("GeoJSON 'type' for geo_point can only be 'Point'");
}
if (coordinates.size() < 2) {
throw new ElasticsearchParseException("GeoJSON 'coordinates' must contain at least two values");
}
if (coordinates.size() == 3) {
GeoPoint.assertZValue(ignoreZValue; coordinates.get(2));
}
if (coordinates.size() > 3) {





