<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # Range Query(范圍查詢) 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html) 譯文鏈接 : [http://www.apache.wiki/pages/viewpage.action?pageId=4260599](http://www.apache.wiki/pages/viewpage.action?pageId=4260599) 貢獻者 : @小布丁 通過某一個包含項的字段匹配文檔。?**Lucene** 查詢的類型取決于字段類型,對于 _string_?(字符串字段),查詢是一個 **TermRangeQuery** ,而對于 _number / date_ 字段,查詢是一個?**NumericRangeQuery?**。下面這個示例返回 _age_ 在 _10_ 到 _20_ 之間的所有文檔。 范圍查詢接受以下參數: | 參數 | 說明 | | --- | --- | | gte | 大于或等于 | | gt | 大于 | | lte | 小于或等于 | | lt | 小于 | | boost | 設置查詢的 _boost_ 值,默認為 _1.0_ | ## ?date (日期)字段的范圍查詢 對類型為 [**date**?](https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html)(日期)的字段運行 **range**?(范圍)查詢時,可以使用 _“[Date Math](https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math)”_ 部分指定范圍: ``` GET _search { "query": { "range" : { "date" : { "gte" : "now-1d/d", "lt" : "now/d" } } } } ``` ### ?Date math 和 rounding (四舍五入) 當使用 **[date math](https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math)** 將日期 _round_ (四舍五入)到最近的日,月,小時等時,舍入日期取決于范圍的結束是包含還是排除。 向上舍入移動到舍入范圍的最后一個毫秒,并向下舍入到舍入范圍的第一個毫秒。 例如: | 參數 | 說明 | | --- | --- | | gt | 大于向上舍入的日期: _2014-11-18 &#124;&#124; / M_ 變成 _2014-11-30T23:59:59.999_ ,即不包括整個月。 | | gte | 大于或等于向下舍入的日期: _2014-11-18 &#124;&#124; / M_ 即成為 _2014-11-01_ ,即包括整個月。 | | lt | 小于向下舍入的日期: _2014-11-18 &#124;&#124; / M_ 成為 _2014-11-01_ ,即不包括整個月。 | | lte | 小于或等于向上舍入的日期: _2014-11-18 &#124;&#124; / M_ 成為 _2014-11-30T23:59:59.999_ ,即包括整個月。 | ### ?Range (范圍)查詢中的日期格式化 格式化的日期將使用指定的默認 **[format](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html)** (格式)解析 [**date**](https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html) (日期)字段,但可以通過將格式參數傳遞到 **range**?(范圍)查詢來覆蓋默認格式: ``` GET _search { "query": { "range" : { "born" : { "gte": "01/01/2012", "lte": "2013", "format": "dd/MM/yyyy||yyyy" } } } } ``` ### ?Range (范圍)查詢中的時區 通過在日期值本身指定時區(如果 **[format](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html)** 允許),日期可以從另一個時區轉換為 **UTC** ,或者可以將其指定為 _time_zone_ 參數: ``` GET _search { "query": { "range" : { "timestamp" : { "gte": "2015-01-01 00:00:00", ① "lte": "now", ② "time_zone": "+01:00" } } } } ``` ①此日期將轉換為 _2014-12-31T23:00:00 UTC_ 。 ②?_now_ 不受 _time_zone_ 參數的影響(日期必須存儲為UTC)。
                  <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>

                              哎呀哎呀视频在线观看