<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國際加速解決方案。 廣告
                # Reverse nested Aggregation 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html#search-aggregations-bucket-reverse-nested-aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-reverse-nested-aggregation.html#search-aggregations-bucket-reverse-nested-aggregation) 譯文鏈接 : [Reverse nested Aggregation](http://apache.wiki/display/Elasticsearch/Reverse+nested+Aggregation?src=contextnavpagetreemode) 貢獻者 : @于永超,[ApacheCN](/display/~apachecn),[Apache中文網](/display/~apachechina) ## Reverse nested Aggregation 一個特殊的單桶聚合,可以從嵌套文檔中聚合父文檔。實際上,這種聚合可以從嵌套的塊結構中跳出來,并鏈接到其他嵌套的結構或根文檔.這允許嵌套不是嵌套對象的一部分的其他聚合在嵌套聚合中。 reverse_nested 聚合必須定義在nested之中 ## **Options** path -?定義了哪些嵌套的應該被連接起來對象字段, 默認為空,這意味著它將返回到 root / main檔級別,該路徑不能包含對嵌套對象字段的引用,該對象字段位于nested聚合的嵌套結構之外,reverse_nested里面 例如,假設我們有一個具有問題和評論的票證系統的索引。 這些意見內嵌在問題文件中作為嵌套文件。 映射可能看起來像 ``` { ... "issue" : { "properties" : { "tags" : { "type" : "text" }, "comments" : { #1 "type" : "nested", "properties" : { "username" : { "type" : "keyword" }, "comment" : { "type" : "text" } } } } } } ``` #1 ?注釋是在問題對象下保存嵌套文檔的數組。 下面的聚合將返回已注釋的頂級評論者的用戶名,以及用戶評論過的問題的頂部標簽 ``` { "query": { "match": { "name": "led tv" } }, "aggs": { "comments": { "nested": { "path": "comments" }, "aggs": { "top_usernames": { "terms": { "field": "comments.username" }, "aggs": { "comment_to_issue": { "reverse_nested": {}, #1 "aggs": { "top_tags_per_comment": { "terms": { "field": "tags" } } } } } } } } } } ``` 如上所述,將reverse_nested聚合放入嵌套聚合,因為這是dsl中唯一可以使用reverse_nested聚合的位置。 其唯一的目的是加入到嵌套結構中較高的父文檔。 #1 ? ?因為沒有定義任何路徑,所以reverse_nested聚合返回到根/主文檔級別。 通過路徑選項,如果在映射中定義了多個分層的嵌套對象類型,則reverse_nested聚合可以返回到不同的級別 可能返回的代碼片: ``` { "aggregations": { "comments": { "top_usernames": { "buckets": [ { "key": "username_1", "doc_count": 12, "comment_to_issue": { "top_tags_per_comment": { "buckets": [ { "key": "tag1", "doc_count": 9 }, ... ] } } }, ... ] } } } } ```
                  <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>

                              哎呀哎呀视频在线观看