I have elasticsearch entity in spring as below :
@Document(indexName = "cities_in", type = "cities")
public class CityDocument {
@Id
private String id;
@Field(type = FieldType.String)
private String city;
@Field(type = FieldType.Object)
@GeoPointField
private GeoPoint location;
}
but when I see mapping using curl curl -s -XGET 'http://localhost:9200/cities_in/cities/_mapping?pretty=1'
I get output as:
{
"cities_in" : {
"mappings" : {
"cities" : {
"properties" : {
"city" : {
"type" : "string"
},
"id" : {
"type" : "string"
},
"location" : {
"properties" : {
"geohash" : {
"type" : "string"
},
"lat" : {
"type" : "double"
},
"lon" : {
"type" : "double"
}
}
}
}
}
}
}
}
and when hit I query I get below error:
{
"error" : {
"root_cause" : [ {
"type" : "query_parsing_exception",
"reason" : "No query registered for [geo_point]",
"index" : "cities_in",
"line" : 1,
"col" : 33
} ],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [ {
"shard" : 0,
"index" : "cities_in",
"node" : "4jGBH3m4SkqNnBwC196hTw",
"reason" : {
"type" : "query_parsing_exception",
"reason" : "No query registered for [geo_point]",
"index" : "cities_in",
"line" : 1,
"col" : 33
}
} ]
},
"status" : 400
}
Why is location type not geo_point
?
How to manage geopoint with spring?