<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Geo Distance Query(地理距離查詢) **dsfs** 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-dsl-geo-distance-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-dsl-geo-distance-query.html) 譯文鏈接 : [Geo Distance Query(地理距離查詢)](/pages/viewpage.action?pageId=10029641) 貢獻者 : [@yangbin](http://www.apache.wiki/display/~yangbin), [ApacheCN](/display/~apachecn),[Apache中文網](/display/~apachechina) 過濾僅包含距離地理位置特定距離內的命中的文檔。 假設以下映射和索引文檔: ``` ?PUT /my_locations { "mappings": { "location": { "properties": { "pin": { "properties": { "location": { "type": "geo_point" } } } } } } } PUT /my_locations/location/1 { "pin" : { "location" : { "lat" : 40.12, "lon" : -71.34 } } } ``` 然后可以使用?**geo_distance?**過濾器執行以下簡單查詢: ``` GET /my_locations/location/_search { "query": { "bool" : { "must" : { "match_all" : {} }, "filter" : { "geo_distance" : { "distance" : "200km", "pin.location" : { "lat" : 40, "lon" : -70 } } } } } } ``` ### Accepted Formats (接受格式) 以同樣的方式,**geo_point** 類型可以接受地理點的不同表示,過濾器也可以接受它: ### Lat Lon As Properties (Lat Lon作為屬性) ``` GET /my_locations/location/_search { "query": { "bool" : { "must" : { "match_all" : {} }, "filter" : { "geo_distance" : { "distance" : "12km", "pin.location" : { "lat" : 40, "lon" : -70 } } } } } } ``` ### Lat Lon As Array (Lat Lon作為陣列) Format in**?`[lon, lat]`**, note, the order of lon/lat here in order to conform with?[GeoJSON](http://geojson.org/). ``` GET /my_locations/location/_search { "query": { "bool" : { "must" : { "match_all" : {} }, "filter" : { "geo_distance" : { "distance" : "12km", "pin.location" : [-70, 40] } } } } } ``` ### Lat Lon As String(Lat Lon作為字符串) Format in?**`lat,lon`. ??** ``` GET /my_locations/location/_search { "query": { "bool" : { "must" : { "match_all" : {} }, "filter" : { "geo_distance" : { "distance" : "12km", "pin.location" : "40,-70" } } } } } ``` ### Geohash(地理散列) ``` GET /my_locations/location/_search { "query": { "bool" : { "must" : { "match_all" : {} }, "filter" : { "geo_distance" : { "distance" : "12km", "pin.location" : "drm3btev3e86" } } } } } ``` ### Options(選項) 以下是過濾器上允許的選項: | `**distance**(距離)` | 以指定位置為中心的圓的半徑。 落入此圈子的點被認為是匹配的。 距離可以用各種單位指定。 看?[the section called “Distance Units](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/common-options.html#distance-units "Distance Unitsedit")[edit](https://github.com/elastic/elasticsearch/edit/5.4/docs/reference/api-conventions.asciidoc "Edit this page on GitHub")”. | | **distance_type**(距離類型) | 如何計算距離。 可以是弧(默認)或平面(更快,但長距離不準確,靠近極點)。 | | **optimize_bbox**(優化bbox) | 是否在距離檢查之前首先運行邊框檢查使用優化。 默認在內存檢查中執行的內存。 也可以使用索引值來使用索引值檢查(在這種情況下確保**geo_pointtype**索引**lat lon**),否則禁用邊界框優化。[~~2.2~~] | | **_name**(名稱) | 可選名稱字段來標識查詢。 | | `**ignore_malformed**(忽略格式錯誤)` | [~~&lt;sub&gt;5.0.0&lt;/sub&gt;~~]?設置為 **true** 以接受無效緯度或經度的地理點(默認值為假)。 | | `**validation_method**(驗證方法)` | 設置為 **IGNORE_MALFORMED** 以接受無效緯度或經度的地理點,設置為 **COERCE** 以額外嘗試推斷正確的坐標(默認為 **STRICT**)。 | ### geo_point Type(geo_point類型) 過濾器需要在相關字段上設置 **geo_point** 類型。 ### Multi Location Per Document(每個文檔的多個位置) **geo_distance** 過濾器可以處理每個文檔的多個位置/點。 一旦單個位置/點與過濾器匹配,文檔將被包含在過濾器中。 ### Ignore Unmapped(忽略未映射) 當設置為 **true** 時,**ignore_unmapped?**選項將忽略未映射字段,并且將不會匹配此查詢的任何文檔。 當查詢可能具有不同映射的多個索引時,可能很有用。 當設置為 **false**(默認值)時,如果字段未映射,則查詢將拋出異常。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看