--- title: "字段名称发现不支持的形状 Line - 如何解决此 Elasticsearch 异常" date: 2026-01-22 lastmod: 2026-01-22 description: "当 Elasticsearch 在 geo_shape 字段中遇到不支持的形状类型(如 Line)时会报此错误。本文介绍如何解决该异常。" tags: ["Elasticsearch", "地理形状", "异常处理", "geo_shape"] summary: "版本: 7.12-8.2 简而言之,当 Elasticsearch 在 geo_shape 字段中遇到不支持的形状类型时,就会发生此错误。geo_shape 字段支持 point(点)、linestring(线串)、polygon(多边形)、multipoint(多点)、multilinestring(多线串)和 multipolygon(多多边形)。如果您尝试索引像 ‘Line’ 这样不支持的形状,就会收到此错误。要解决此问题,您可以将形状类型更改为支持的类型之一,或者使用支持您尝试索引的形状的其他字段类型。 日志上下文 # 日志 “Field [” + name + “] found an unsupported shape Line” 的类名是 GeoShapeUtils.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考: public Void visit(org.elasticsearch.geometry.Line line) { if (line.isEmpty() == false) { if (relation == ShapeRelation.WITHIN) { // Line geometries and WITHIN relation is not supported by Lucene. Throw an error here // to have same behavior for runtime fields." --- > **版本:** 7.12-8.2 简而言之,当 Elasticsearch 在 geo_shape 字段中遇到不支持的形状类型时,就会发生此错误。geo_shape 字段支持 point(点)、linestring(线串)、polygon(多边形)、multipoint(多点)、multilinestring(多线串)和 multipolygon(多多边形)。如果您尝试索引像 'Line' 这样不支持的形状,就会收到此错误。要解决此问题,您可以将形状类型更改为支持的类型之一,或者使用支持您尝试索引的形状的其他字段类型。 日志上下文 ----------- 日志 "Field [" + name + "] found an unsupported shape Line" 的类名是 [GeoShapeUtils.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考: ```java public Void visit(org.elasticsearch.geometry.Line line) { if (line.isEmpty() == false) { if (relation == ShapeRelation.WITHIN) { // Line geometries and WITHIN relation is not supported by Lucene. Throw an error here // to have same behavior for runtime fields. throw new QueryShardException(context; "Field [" + name + "] found an unsupported shape Line"); } geometries.add(GeoShapeUtils.toLuceneLine(line)); } return null; } ```