Expected a list of points but got a point – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.2-8.9

Briefly, this error occurs when Elasticsearch expects a list of points (coordinates) for a geospatial query, but only receives a single point. This could be due to incorrect formatting or data input. To resolve this issue, ensure that your data input matches the expected format. If you’re using a geo_shape query, make sure you’re providing an array of points. If you’re using a geo_point query, ensure you’re providing a single point. Also, check your mapping to ensure it matches the data type you’re querying.

This guide will help you check for common problems that cause the log ” expected a list of points but got a point ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: .

Log Context

Log “expected a list of points but got a point” class name is GeoJson.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 return coordinate;
 }  public MultiPoint asMultiPoint() {
 if (coordinate != null) {
 throw new ElasticsearchException("expected a list of points but got a point");
 }
 List points = new ArrayList<>();
 for (CoordinateNode node : children) {
 points.add(node.asPoint());
 }

 

 [ratemypost]