# Geo Distance Range Query（地理距离范围查询）

> 5.0 的版本已经废弃

```
GET /_search
{
    "query": {
        "bool" : {
            "must" : {
                "match_all" : {}
            },
            "filter" : {
                "geo_distance_range" : {
                    "from" : "200km",
                    "to" : "400km",
                    "pin.location" : {
                        "lat" : 40,
                        "lon" : -70
                    }
                }
            }
        }
    }
}
```

支持与 [**geo\_distance**](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-dsl-geo-distance-query.html)过滤器相同的点位置参数和查询选项。 并且还支持范围（**lt，lte，gt，gte，from，to，include\_upper** 和**include\_lower**）的常用参数。

## Ignore Unmapped（忽略未映射） <a href="#geodistancerangequery-di-li-ju-li-fan-wei-cha-xun-ignoreunmapped-hu-lve-wei-ying-she" id="geodistancerangequery-di-li-ju-li-fan-wei-cha-xun-ignoreunmapped-hu-lve-wei-ying-she"></a>

当设置为**true**时，**ignore\_unmapped**选项将忽略未映射字段，并且将不匹配此查询的任何文档。 当查询可能具有不同映射的多个索引时，这可能很有用。 当设置为**false**（默认值）时，如果字段未映射，则查询将抛出异常。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaoxiami.gitbook.io/elasticsearch/ji-chu/35query-dsldslfang-shi-cha-8be229/357di-li-wei-zhi-cha-xun-geo-queries/geo-distance-range-queryff08-di-li-ju-li-fan-wei-cha-xun-ff09.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
