Error on inserting geo_point in elasticsearch through java

I have an index in Elasticsearch in which there is a field of geo_point. The mapping file is somewhat like this.
curl -XPUT 'localhost:9200/test_geo5' -d'
"lat":{ "type": "string","index": "not_analyzed"},
"lon":{ "type": "string","index": "not_analyzed"},
"message_geocoordinates":{ "type": "geo_point"}

I want to insert message_geocoordinates using java code.

So I wrote java code like this

String latitude= xxxxx;
String longitude= yyyy;
String message_geocordinates= latitude+","+longitude;
JSONObject jj = new JSONObject();
jj.put("lat", latitude);
jj.put("lon", longitude);
IndexResponse response = client.prepareIndex("test_geo5", "iiiii").setSource(jj.toString()).execute().actionGet();

and I tried to insert it in Elasticsearch. But I received following exception.
So it says that my message_geocoordinates field is String in java but it is GeoPointFieldType for elatic search.

How can I insert geopoint field into elasticsearch using java code.

There are four ways that a geo-point may be specified

From Geo-point datatype | Elasticsearch Guide [5.0] | Elastic

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.