在Spring 的实体里定义了一个属性
private GeoPoint position;
索引建立没有问题,但是查询是报错QueryParsingException: [my-index] failed to find geo_point field [position]
然后Get /my-index/_mapping 发现
"position": { "properties": { "lat": { "type": "double" }, "lon": { "type": "double"
} } },
position 的type并不是 geo_point.
通过查找资料http://es.xiaoleilu.com/310_Geopoints/20_Geopoints.html (这个网址里是Looly翻译的Elasticsearch的中文指南)
创建索引首先声明geo_point类型,然后就可以了
以上是个人见解,如有问题请大家指出纠正。