<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 功能強大 支持多語言、二開方便! 廣告
                # Has Child Query 原文鏈接 [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-child-query.html#_scoring_capabilities](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-child-query.html#_scoring_capabilities) 譯文鏈接 [http://www.apache.wiki/pages/editpage.action?pageId=5505029](http://www.apache.wiki/pages/editpage.action?pageId=5505029) 貢獻者 @小蚊子 ?has_child 過濾接受一個查詢和child類型來執行,產生其子文檔能匹配查詢的父文檔。這有一個例子: ``` curl -XGET 'localhost:9200/_search?pretty' -d' { "query": { "has_child" : { "type" : "blog_tag", "query" : { "term" : { "tag" : "something" } } } } }' ``` ## Scoring capabilities(打分能力) has_child也支持打分。支持的模式有min,max,sum,avg,或者none.默認的是none,產生和以前的版本相同的行為。如果打分模式設置為none意外的其他值,匹配子文檔的所有分數將被聚合在有關聯的父文檔。has_child查詢中的score_mode字段指定打分類型的值: ``` curl -XGET 'localhost:9200/_search?pretty' -d' { "query": { "has_child" : { "type" : "blog_tag", "score_mode" : "min", "query" : { "term" : { "tag" : "something" } } } } }' ``` ## Min/Max Children(最小/最大子文檔) has_child 查詢允許你指定最小或者(和)最大數目的子文檔需要匹配,來使父文檔被當做一個匹配: ``` curl -XGET 'localhost:9200/_search?pretty' -d' { "query": { "has_child" : { "type" : "blog_tag", "score_mode" : "min", "min_children": 2, "max_children": 10,? "query" : { "term" : { "tag" : "something" } } } } }' ``` ``` min_children和max_children都是可選的 ``` `min_children`?和?`max_children`?參數可以和score_mode參數結合使用 ## ignore unmapped(忽略未映射) 如果把Ignore_unmapped選項設置為true,將忽略一個沒被索引的類型,從該查詢中不會匹配任何文檔。這個選項在查詢不同的映射導致的多索引查詢時有用。當設置為false(默認值),如果類型沒有被映射時查詢將拋出異常。 ## Sorting(排序) 父文檔不能以經常作為子文檔的排序字段來排序。如果你需要用子文檔中的字段來給父文檔排序時,你可以用function_score查詢,使用_score來排序。 根據子文檔的click_count字段排序: ``` curl -XGET 'localhost:9200/_search?pretty' -d' { "query": { "has_child" : { "type" : "blog_tag", "score_mode" : "max", "query" : { "function_score" : { "script_score": { "script": "_score * doc[\u0027click_count\u0027].value" } } } } } }' ```
                  <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>

                              哎呀哎呀视频在线观看