I have the code
if(row.get("LATITUDE") != null && row.get("LONGITUDE") != null) {
result.put("geoPoint", ImportUtils.getGeoPoint(row));}
public static Map<String, Object> getGeoPoint(Map<String, Object> s) {
Map<String, Object> r = new HashMap<>();
BigDecimal lat = (BigDecimal) s.get("LATITUDE");
BigDecimal lon = (BigDecimal) s.get("LONGITUDE");
r.put("lat", lat.doubleValue());//широта -90/90
r.put("lon", lon.doubleValue());//долгота -180/180
return r;
}
The problem is that if I do this, some objects don't have the geopoint field, but if I put null or put longitude and latitude as null, then there is a mapping error.
I want it to be like this if geopoint is null
"geopoint": {},
//or as a last resort
"geopoint" : null
Mapping
},
"geoPoint": {
"type": "geo_point"
}
I tried null_value: null, but for some reason it didn't work How can I achieve the result I need?
Update your mapping w/ ignore_malformed
:
...
{
"type" : "geo_point",
"ignore_malformed" : true
}
...