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

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ### 匹配查詢 不管你搜索什么內容,`match`查詢是你首先需要接觸的查詢。它是一個高級查詢,意味著`match`查詢知道如何更好的處理全文檢索和準確值檢索。 這也就是說,`match`查詢的一個主要用途是進行全文搜索。讓我們通過一個小例子來看一下全文搜索是如何工作的。 #### 索引一些數據 首先,我們使用`bulk` API來創建和索引一些文檔: ```json DELETE /my_index <1> PUT /my_index { "settings": { "number_of_shards": 1 }} <2> POST /my_index/my_type/_bulk { "index": { "_id": 1 }} { "title": "The quick brown fox" } { "index": { "_id": 2 }} { "title": "The quick brown fox jumps over the lazy dog" } { "index": { "_id": 3 }} { "title": "The quick brown fox jumps over the quick dog" } { "index": { "_id": 4 }} { "title": "Brown fox brown dog" } ``` // SENSE: 100_Full_Text_Search/05_Match_query.json <1> 刪除已經存在的索引(如果索引存在) <2> 然后,`關聯失效`這一節解釋了為什么我們創建該索引的時候只使用一個主分片。 #### 單詞查詢 第一個例子解釋了當使用`match`查詢進行單詞全文搜索時發生了什么: ```json GET /my_index/my_type/_search { "query": { "match": { "title": "QUICK!" } } } ``` // SENSE: 100_Full_Text_Search/05_Match_query.json Elasticsearch通過下面的步驟執行`match`查詢: 1. _檢查field類型_ `title`字段是一個字符串(`analyzed`),所以該查詢字符串也需要被分析(`analyzed`) 2. _分析查詢字符串_ 查詢詞`QUICK!`經過標準分析器的分析后變成單詞`quick`。因為我們只有一個查詢詞,因此`match`查詢可以以一種低級別`term`查詢的方式執行。 3. _找到匹配的文檔_ `term`查詢在倒排索引中搜索`quick`,并且返回包含該詞的文檔。在這個例子中,返回的文檔是1,2,3。 4. _為每個文檔打分_ `term`查詢綜合考慮詞頻(每篇文檔`title`字段包含`quick`的次數)、逆文檔頻率(在全部文檔中`title`字段包含`quick`的次數)、包含`quick`的字段長度(長度越短越相關)來計算每篇文檔的相關性得分`_score`。(更多請見相關性介紹) 這個過程之后我們將得到以下結果(簡化后): ```json "hits": [ { "_id": "1", "_score": 0.5, <1> "_source": { "title": "The quick brown fox" } }, { "_id": "3", "_score": 0.44194174, <2> "_source": { "title": "The quick brown fox jumps over the quick dog" } }, { "_id": "2", "_score": 0.3125, <2> "_source": { "title": "The quick brown fox jumps over the lazy dog" } } ] ``` <1> 文檔1最相關,因為 `title` 最短,意味著`quick`在語義中起比較大的作用。 <2> 文檔3比文檔2更相關,因為在文檔3中`quick`出現了兩次。
                  <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>

                              哎呀哎呀视频在线观看