我使用spring 1.5.1和Elasticsearch 2.3.5 (对于Mahout推荐系统),所以我在映射方面遇到了问题:
@GeoPointField
private GeoPoint location;来自包裹:
org.springframework.data.elasticsearch.core.geo;因此,通过mapping?pretty=1,我有:
location: {
properties: {
lat: {
type: "double"
},
lon: {
type: "double"
}
}
}但是,我希望位置字段是geo_point类型。
因此,当我试图:
CriteriaQuery query = new CriteriaQuery(new Criteria("location").within(startLocation, range));我有:
QueryParsingException[failed to find geo_point field [location]]有人知道解决办法吗?Thx
发布于 2017-02-23 13:55:03
问题在于你的地图。它应该是geo_point类型。例如:
你可以用卷曲式来做
curl -XPUT 'http://localhost:9200/your_index/_mapping/your_type' -d '
{
"your_type" : {
"properties" : {
"phone": {
"type": "string", "index": "not_analyzed"
},
"webSite": {
"type": "string", "index": "not_analyzed"
}
"location": {
{"type": "geo_point"}
}
}
}
'保存数据时,可以:
"location":{
"lat":11.68036,
"lon":-93.3103
}https://stackoverflow.com/questions/42417417
复制相似问题