Briefly, this error occurs when the ‘type’ field in a GeoJSON object is not a string. GeoJSON is a format for encoding geographic data structures. The ‘type’ field is mandatory and should be a string indicating the type of the GeoJSON object (e.g., “Point”, “Polygon”). To resolve this issue, ensure that the ‘type’ field is a string. If you’re generating the GeoJSON programmatically, check your code to ensure it’s correctly formatting the ‘type’ field. If you’re manually creating the GeoJSON, ensure you’re correctly typing the ‘type’ field as a string.
This guide will help you check for common problems that cause the log ” GeoJSON ‘type’ must be a string ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: .
Log Context
Log “GeoJSON ‘type’ must be a string” class name is GeoUtils.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :
} } else if (TYPE.equals(field)) { if (subParser.currentToken() == Token.VALUE_STRING) { geojsonType = subParser.text(); } else { throw new ElasticsearchParseException("GeoJSON 'type' must be a string"); } } else { throw new ElasticsearchParseException( "field must be either [{}]; [{}]; [{}]; [{}] or [{}]"; LATITUDE;