1
我试图按距离对搜索结果排序。然而,当我尝试,我得到以下错误:当按距离排序时ES发生错误
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "sort option [location] not supported"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "roeselaredev",
"node": "2UYlfd7sTd6qlJWgdK2wzQ",
"reason": {
"type": "illegal_argument_exception",
"reason": "sort option [location] not supported"
}
}
]
},
"status": 400
}
查询我送这个样子的:
GET _search
{
"query": {
"match_all": []
},
"sort": [
{
"geo_distance": {
"location": {
"lat": 50.9436034,
"long": 3.1242917
},
"order":"asc",
"unit":"km",
"distance_type":"plane"
}
},
{
"_score": {
"order":"desc"
}
}
]
}
尽可能靠近我可以告诉我跟着文档的信中的指示。我没有收到格式不正确的查询结果。我只是得到了按距离排序选项不支持的结果。任何想法,我做错了什么?
如何映射'geo_distance'? – Sylwit
geo_distance是过滤器的名称,未映射。 位置映射如下: 'location:{type:geo_point,property_path:esGetLocation}'esGetLocation方法只返回一个包含纬度和长连接的字符串(用逗号分开) –