【发布时间】:2015-03-04 22:58:46
【问题描述】:
我收到了QueryParsingException[[listings] failed to find geo_point field [location.coords]]; }],但不知道为什么。
我的查询
esClient.search({
index: 'listings',
body: {
query: {
filtered: {
query: {
match_all: {}
},
filter: {
geo_distance: {
distance: '10km',
'location.coords': {
lat: parseFloat(query.point.lat),
lon: parseFloat(query.point.lon)
}
}
}
}
}
}
}, function(err, response) {
if(err) return console.log(err);
console.log(response);
});
我的映射(如您所见 - 是的,我确实使用了 geo_point 类型)
body: {
properties: {
location: {
type: 'object',
properties: {
country: {
type: 'integer'
},
address: {
type: 'string'
},
suburb: {
type: 'string'
},
coords: {
type: 'geo_point',
precision: '3m'
}
}
}
}
}
编辑:
查看 http://localhost:9200/listings/_mapping/my-mapping 后,我注意到 coords 字段的 lat、lon 设置为双倍 - 这可能与此有关吗?
【问题讨论】:
标签: elasticsearch