Geo coordinates must be numbers – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when the geo-coordinates provided to Elasticsearch are not in the correct numeric format. Elasticsearch expects geo-coordinates to be numbers (latitude and longitude). If you provide a string or any other data type, it will throw this error. To resolve this issue, ensure that the geo-coordinates are in the correct numeric format. Also, check your data source to ensure it’s providing the correct data types. If you’re using a script to input data, verify that it’s correctly converting strings to numbers before sending them to Elasticsearch.

This guide will help you check for common problems that cause the log ” geo coordinates must be numbers ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: .

Log Context

Log “geo coordinates must be numbers” class name is GeoJson.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 * Parser a singe set of 2 or 3 coordinates
 */
 private static Point parseCoordinate(XContentParser parser) throws IOException {
 // Add support for coerce here
 if (parser.currentToken() != XContentParser.Token.VALUE_NUMBER) {
 throw new ElasticsearchParseException("geo coordinates must be numbers");
 }
 double lon = parser.doubleValue();
 if (parser.nextToken() != XContentParser.Token.VALUE_NUMBER) {
 throw new ElasticsearchParseException("geo coordinates must be numbers");
 }

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?