0
映射address
属性:name
id
和type
location
。 搜索映射:elasticsearch GEO的搜索顺序由近至远
{
"address": {
"properties": {
"id": {
"type": "long"
},
"type": {
"type": "long"
},
"name": {
"type": "string"
},
"location": {
"type": "geo_point"
}
}
}
}
搜索CMD(滤波器address.type = 1
和distance = 100km
):
XGET /_search
{
"query": {
"filtered": {
"query": {
"match": {
"type": 1
}
},
"filter": {
"geo_distance": {
"distance": "100km",
"location": {
"lat": 24.46667,
"lon": 118.1
}
}
}
}
}
}
我想搜索地址匹配type = 1
和地理distance = 100km
;我想得到的结果是order by distance ASC
。如何解决这个问题?
是的,它的工作原理。谢谢! –