I'm trying to create documents from a Java app. Those documents includes geographic coordinates (lat and lon in decimal form).
Both Elasticsearch and the java client are in 8.6.0.
In the beginning, no index exists in ES.
If I only insert data, the index is created but the coordinates are not typed as coordinates.
I tried several types in my Java object : GeoPoint, GeoHash, GeoLocation.
I also tried to create the index at first with a specific mapping :
CreateIndexResponse response = client.indices().create(c -> c
.mappings(map -> map
.properties("position", p -> p.geoPoint(g -> g))));
And then, I have errors when inserting data with a bulk request.
How can I do that operation ?
Thanks for your help.
Hello David !
I have a com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: ch.hsr.geohash.GeoHash
My documents are Java objects with String attributes and, on my last try, a Geohash for the position.
Each attribute has a getter and a setter.
The source data provides lat and lon.
I try to convert it with
When I do as you did, the data is created but as double and distinct values :
In the mapping of the index, the location looks like (the index does not exist before I run the code, that's why I performed operations on the server side, to tell him how to create the index)