This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9513|Reply: 0

ElasticsearchParseException[field must be either [lat], [lon] or [geohash]]

[Copy link]
Posted on 1/9/2019 5:04:25 PM | | | |


ElasticsearchParseException [fields must be [lat], [lon], or [geohash]];

Based on the literal clarity of what the problem is, we print out the serialized json as follows:

{"bizStatus":"EMPTY","companyId":"dz123","driverRegionCode":1,"position":{"fragment":true,"geohash":"s1zyd63zwsd7","lat":11.0,"lon":11.0},"speed":10,"time" :1547021108810,"vehicleNo":"沪A123456"}
Analytical Questions:

position field I use the GeoPoint object of es, and when submitting data, either only the latitude and longitude is submitted, or only the geohash is submitted.

Solution:

We redefine an object of latitude and longitude as follows:



The re-serialized JSON data is as follows:

Or something like the following structure is also acceptable

Resources:

https://stackoverflow.com/questi ... h-with-a-java-class




Previous:【E-book】In-depth understanding of Android kernel design ideas PDF
Next:Java Geolocation Information in ElasticSearch (geo_point)
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com