【发布时间】:2015-05-26 10:29:12
【问题描述】:
我有一个关于 elasticsearch 的小问题。
我在表中使用下一个映射。 (地名表)
{
"zoek": {
"mappings": {
"geo": {
"properties": {
"country": {
"type": "string"
},
"geonameid": {
"type": "string"
},
"locatie": {
"type": "geo_point"
},
"name": {
"type": "string"
}
}
}
}
}
}
"locate" 是一个双精度数组的 geo_point 映射。
所以搜索我们当地的村庄“rhee”可以正常工作:
GET /zoek/geo/_search
{
"query": {
"match": { "name": "rhee" }
}
}
答案:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 8.156567,
"hits": [
{
"_index": "zoek",
"_type": "geo",
"_id": "4533",
"_score": 8.156567,
"_source": {
"geonameid": "2748193",
"name": "Rhee",
"locatie": [
53.0325,
6.56667
],
"country": "NL"
}
}
]
}
}
-> 现在我想查询“rhee”半径15公里范围内的所有地方 (例如)
GET /zoek/geo/_search
{
"filtered" : {
"query" : {
"match": { "name": "rhee" }
},
"filter" : {
"geo_distance" : {
"distance" : "15km",
"locatie" : [ 53.0325, 6.56667 ]
}
}
}
}
}
引发以下异常:
SearchPhaseExecutionException[执行阶段[查询]失败,所有分片失败;分片失败
解析失败[元素[过滤]没有解析器]]
另外,这个查询:
get /zoek/geo/_search
{
"query": {
"filtered": {
"filter": {
"geo_distance": {
"distance": "5km",
"locatie": [ 53.0325, 6.56667 ]
}
}
}
}
}
}
返回所有字段而不是 5 公里的距离记录。
有什么建议吗?
和平,
数码
【问题讨论】:
标签: elasticsearch