<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國際加速解決方案。 廣告
                # Inner hits 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html) 譯文鏈接 : [http://www.apache.wiki/pages/editpage.action?pageId=4883116](http://www.apache.wiki/pages/editpage.action?pageId=488308) 貢獻者 : [ping](/display/~wangyangting) 父/子和嵌套功能允許返回在不同范圍內具有匹配的文檔。 在父/子情況下,基于子文檔中的匹配返回父文檔,或者基于父文檔中的匹配返回子文檔。 在嵌套的情況下,基于嵌套內部對象中的匹配返回文檔。 在這兩種情況下,導致返回文檔的不同作用域中的實際匹配都被隱藏。 在許多情況下,知道哪些內部嵌套對象(在嵌套的情況下)或子/父文檔(在父/子)的情況下導致返回某些信息是非常有用的。 內部命中功能可用于此。 此功能會在搜索響應中返回每個搜索匹配的附加嵌套匹配,導致搜索匹配在不同范圍內匹配。 可以通過在嵌套,has_child或has_parent查詢和過濾器上定義inner_hits定義來使用內部命中。 結構如下所示: ``` "<query>" : { "inner_hits" : { <inner_hits_options> } } ``` 如果在支持它的查詢上定義 inner_hits,則每個搜索命中將包含具有以下結構的 inner_hits json 對象: ``` ?"hits": [ { "_index": ..., "_type": ..., "_id": ..., "inner_hits": { "<inner_hits_name>": { "hits": { "total": ..., "hits": [ { "_type": ..., "_id": ..., ... }, ... ] } } }, ... }, ... ] ``` ### Options 內部命中支持以下選項: | `from` | The offset from where the first hit to fetch for each?`inner_hits`?in the returned regular search hits.從返回的常規搜索命中的每個 inner_hits 的第一個命中的獲取位置的偏移量。 | | `size` | 每個 inner_hits 返回的命中的最大數量。 默認情況下,返回前三個命中匹配。 | | `sort` | 如何內部命中應該按inner_hits排序。 默認情況下,匹配按分數排序。 | | `name` | 在響應中用于特定內部命中定義的名稱。 在單個搜索請求中定義多個內部命中時非常有用。 默認值取決于定義內部命中的查詢。 對于 has_child 查詢和過濾器,這是子類型,對于 has_parent 查詢和過濾器,這是父類型和嵌套查詢,對于過濾器,這是嵌套路徑。 | 內部命中還支持以下每個文檔功能: * [Highlighting](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html "Highlighting") * [Explain](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-explain.html "Explain") * [Source filtering](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html "Source filtering") * [Script fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html "Script Fields") * [Doc value fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-docvalue-fields.html "Doc value Fields") * [Include versions](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-version.html "Version") ### Nested inner hits 嵌套 inner_hits 可用于將嵌套內部對象包含為搜索匹配的內部匹配。 下面的示例假設有一個使用名稱 comment 定義的嵌套對象字段: ``` ?{ "query" : { "nested" : { "path" : "comments", "query" : { "match" : {"comments.message" : "[actual query]"} }, "inner_hits" : {} ① } } } ``` ①?嵌套查詢中的內部命中定義。 沒有其他選項需要定義。 一個可以從上述搜索請求生成的響應片段的示例: ``` ?... "hits": { ... "hits": [ { "_index": "my-index", "_type": "question", "_id": "1", "_source": ..., "inner_hits": { "comments": { ① "hits": { "total": ..., "hits": [ { "_nested": { "field": "comments", "offset": 2 }, "_source": ... }, ... ] } } } }, ... ``` ①?搜索請求中的內部匹配定義中使用的名稱。 可以通過名稱選項使用自定義鍵。 在上面的例子中,_nested 元數據是至關重要的,因為它定義了這個內部命中來自什么內部嵌套對象。 該字段定義嵌套命中來自的對象數組字段,以及相對于其在 _source 中的位置的偏移。 由于排序和評分,命中對象在 inner_hits 中的實際位置通常不同于定義嵌套內部對象的位置。 默認情況下,對于 inner_hits 中的命中對象也返回 _source ,但這可以更改。 通過 _source 過濾功能部分源可以返回或禁用。 如果存儲字段在嵌套級別上定義,則也可以通過字段特性返回。 一個重要的缺省是在 inner_hits 內的 hits 中返回的 _source 是相對于 _nested 元數據。 因此,在上面的示例中,僅對每個嵌套的匹配返回注釋部分,而不是包含注釋的頂級文檔的整個源。 ### Hierarchical levels of nested object fields and inner hits 如果映射具有多層次的層次化嵌套對象字段,則每個層次都可以通過點標記路徑訪問。 例如,如果存在包含票據嵌套字段的注釋嵌套字段,并且應該直接使用根命中返回票,則可以定義以下路徑: ``` ?{ "query" : { "nested" : { "path" : "comments.votes", "query" : { ... }, "inner_hits" : {} } } } ``` 此間接引用僅支持嵌套內部命中。 Parent/child inner hits 父/子inner_hits可以用于包括父或子 以下示例假定在注釋類型中存在_parent字段映射: ``` ?{ "query" : { "has_child" : { "type" : "comment", "query" : { "match" : {"message" : "[actual query]"} }, "inner_hits" : {} ① } } } ``` ① ?內部命中定義類似于嵌套示例。 一個可以從上述搜索請求生成的響應片段的示例: ``` ?... "hits": { ... "hits": [ { "_index": "my-index", "_type": "question", "_id": "1", "_source": ..., "inner_hits": { "comment": { "hits": { "total": ..., "hits": [ { "_type": "comment", "_id": "5", "_source": ... }, ... ] } } } }, ... ```
                  <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>

                              哎呀哎呀视频在线观看