版本: 6.8-8.9
简而言之,当 Elasticsearch 期望地理空间数据使用 GeoJSON 对象数组,但提供的输入不符合此要求时,就会发生此错误。要解决此问题,请确保"geometries"字段包含有效的 GeoJSON 对象数组。检查数据输入是否存在任何不一致或格式错误。同时,确保索引的映射已正确设置为处理 GeoJSON 对象。如果错误仍然存在,请考虑使用正确的 GeoJSON 格式重新索引数据。
日志上下文 #
日志 “geometries must be an array of geojson objects” 的类名是 GeoJsonParser.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景的人员参考:
* @return Geometry[] geometries of the GeometryCollection
* @throws IOException Thrown if an error occurs while reading from the XContentParser
*/
static GeometryCollectionBuilder parseGeometries(XContentParser parser; AbstractShapeGeometryFieldMappermapper) throws IOException {
if (parser.currentToken() != XContentParser.Token.START_ARRAY) {
throw new ElasticsearchParseException("geometries must be an array of geojson objects");
}
XContentParser.Token token = parser.nextToken();
GeometryCollectionBuilder geometryCollection = new GeometryCollectionBuilder();
while (token != XContentParser.Token.END_ARRAY) {





