Briefly, this error occurs when the GeoJSON object you’re trying to index in Elasticsearch doesn’t have at least two values in its ‘coordinates’ field. GeoJSON objects require at least two coordinates (latitude and longitude) to define a point in space. To resolve this issue, ensure that your GeoJSON objects have at least two coordinates. If the data is coming from an external source, validate it before indexing. If you’re generating the data, check your generation logic to ensure it’s producing valid GeoJSON.
This guide will help you check for common problems that cause the log ” GeoJSON ‘coordinates’ must contain at least two values ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: .
Log Context
Log “GeoJSON ‘coordinates’ must contain at least two values” class name is GeoUtils.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :
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) { GeoPoint.assertZValue(ignoreZValue; coordinates.get(2)); } if (coordinates.size() > 3) {
[ratemypost]