--- title: "GeoJSON类型用于地理点只能是Point - 如何解决此Elasticsearch异常" date: 2026-02-13 lastmod: 2026-02-13 description: "当尝试在Elasticsearch中索引包含geo_point字段的文档时,如果GeoJSON对象的类型不是Point,会引发此错误。Elasticsearch的geo_point字段只支持Point类型。" tags: ["Elasticsearch", "GeoJSON", "geo_point", "地理数据", "数据类型"] summary: " 版本: 8.2-8.2 简而言之,当您尝试在Elasticsearch中索引包含geo_point字段的文档时,如果GeoJSON对象的’type’不是’Point',就会出现此错误。Elasticsearch的geo_point字段只支持’Point’类型。要解决此问题,请确保GeoJSON对象的’type’为’Point'。如果您使用的是’Polygon’或’LineString’等其他类型,请考虑使用geo_shape数据类型。此外,请检查您的数据源,确保其提供正确的GeoJSON格式。 日志上下文 # 日志"GeoJSON ‘type’ for geo_point can only be ‘Point’“的类名是 GeoUtils.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考: if (geohash != null) { return point.parseGeoHash(geohash; effectivePoint); } 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) { " --- > **版本:** 8.2-8.2 简而言之,当您尝试在Elasticsearch中索引包含geo_point字段的文档时,如果GeoJSON对象的'type'不是'Point',就会出现此错误。Elasticsearch的geo_point字段只支持'Point'类型。要解决此问题,请确保GeoJSON对象的'type'为'Point'。如果您使用的是'Polygon'或'LineString'等其他类型,请考虑使用geo_shape数据类型。此外,请检查您的数据源,确保其提供正确的GeoJSON格式。 日志上下文 ----------- 日志"GeoJSON 'type' for geo\_point can only be 'Point'"的类名是[GeoUtils.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考: ```java if (geohash != null) { return point.parseGeoHash(geohash; effectivePoint); } 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) { ```