3
我使用Geo Distance Filter與ElasticSearch不管我什麼搜索距離爲我,elasticsearch 0.90.11返回零結果。地理距離與ElasticSearch過濾器總是返回0結果
這裏就是我所做的:首先,刪除/創建具有地理映射一個新的指標:
curl -XDELETE 'http://localhost:9200/photos'
curl -XPOST 'http://localhost:9200/photos' -d '
{
"mappings": {
"pin" : {
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}
}
}
'
然後,添加一個文件:
curl -XPOST 'http://localhost:9200/photos/photo?pretty=1' -d '
{
"pin" : {
"location" : {
"lat" : 46.8,
"lon" : -71.2
}
},
"file" : "IMG_2115.JPG"
}
'
然後搜索:
curl -XGET 'http://localhost:9200/photos/_search?pretty=1&size=20' -d '
{
"query" : {
"match_all" : {}
},
"filter" : {
"geo_distance" : {
"distance" : "10km",
"pin.location" : {
"lat" : "46.8",
"lon" : "-71.2"
}
}
}
}
'
但搜索收益的匹配率爲零:
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
任何人都知道爲什麼,它沒有找到半徑範圍內的文件?作爲一個有趣的方面說明,在上面引用的文檔中描述的具有「查詢」和「過濾器」作爲子字段的「過濾」語法似乎不再起作用,似乎現在「查詢」和「過濾器」需要是在json查詢的頂層。
任何幫助表示讚賞...
+1謝謝!我一直在想這個問題2天。 –
我提交了[拉入請求(https://github.com/elastic/elasticsearch/pull/15745)來更新誤導文檔。 – Jonny