Geo Distance Range Query(地理距离范围查询)
原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-dsl-geo-distance-range-query.html
译文链接 : Geo Distance Range Query(地理距离范围查询)
贡献者 : @yangbin,ApacheCN,Apache中文网
[5.0.0]
过滤某一特定范围中存在的文档:
GET /_search
{
"query": {
"bool" : {
"must" : {
"match_all" : {}
},
"filter" : {
"geo_distance_range" : {
"from" : "200km",
"to" : "400km",
"pin.location" : {
"lat" : 40,
"lon" : -70
}
}
}
}
}
}
支持与 geo_distance 过滤器相同的点位置参数和查询选项。 并且还支持范围(lt,lte,gt,gte,from,to,include_upper 和 include_lower)的常用参数。
Ignore Unmapped(忽略未映射)
当设置为 true 时,ignore_unmapped 选项将忽略未映射字段,并且将不匹配此查询的任何文档。 当查询可能具有不同映射的多个索引时,这可能很有用。 当设置为 false(默认值)时,如果字段未映射,则查询将抛出异常。