Briefly, this error occurs when there is a mismatch between the expected and actual geometry type in Elasticsearch’s geo_shape field. This could be due to incorrect data input or mapping. To resolve this, ensure that the data type matches the mapping definition. If the error persists, you may need to reindex your data with the correct mapping. Also, check your data input for any inconsistencies or errors. It’s important to ensure that the geometry type in your data matches the type defined in your Elasticsearch mapping.
This guide will help you check for common problems that cause the log ” Expected geometry type [{}] but found [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: .
Log Context
Log “Expected geometry type [{}] but found [{}]” class name is GeoWKTParser.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :
final boolean coerce ) throws IOException; ElasticsearchParseException { final GeoShapeType type = GeoShapeType.forName(nextWord(stream)); if (shapeType != null && shapeType != GeoShapeType.GEOMETRYCOLLECTION) { if (type.wktName().equals(shapeType.wktName()) == false) { throw new ElasticsearchParseException("Expected geometry type [{}] but found [{}]"; shapeType; type); } } return switch (type) { case POINT -> parsePoint(stream; ignoreZValue; coerce); case MULTIPOINT -> parseMultiPoint(stream; ignoreZValue; coerce);