<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 功能強大 支持多語言、二開方便! 廣告
                # Bucket Selector Aggregation(桶選擇器聚合) 警告 此功能是實驗性的,可能會在未來的版本中完全更改或刪除。Elastic將采取最大的努力來解決任何問題,但實驗功能不受SLA官方功能的支持。 父管道聚合,它執行一個腳本,該腳本確定當前桶是否將保留在父多桶聚合中。指定度量必須是數字,腳本必須返回一個布爾值。如果腳本語言是表達式,則允許數字返回值。在這種情況下,0.0將被判定為false,所有的其他值將被判定為true。 注意:bucket_selector聚合,像所有管道聚合,在所有的其他同級聚合后執行。這意味著使用bucket_selector聚合過濾返回的響應數據中不會保存運行時的聚合。 ## Syntax(語法) bucket_selector聚合看起來像這樣: ``` { "bucket_selector": { "buckets_path": { "my_var1": "the_sum", #1 "my_var2": "the_value_count" }, "script": "params.my_var1 > params.my_var2" } } ``` | 1 | 這里,my_var1是這個桶的路徑中使用腳本中的變量的名稱,the_sum是路徑的度量所使用的變量。 | ## Table?12.?`bucket_selector`?Parameters(Table 12.bucket_selector參數) | 參數名稱 | 描述 | 是否必要 | 默認值 | | --- | --- | --- | --- | | `script` | 在這個聚合上運行的腳本。這個腳本可以是內置的,文件或索引。(詳細信息,請參閱Scripting) | 必須 | ? | | `buckets_path` | 腳本變量的映射,以及我們希望用于桶的變量的相關路徑(相關詳細信息,請參閱“buckets_path Syntax”一節) | 必須 | ? | | `gap_policy` | 在數據中找到差異時應用的策略(相關詳情:請參閱“Dealing with gaps in the data”一節) | 可選 | `skip` | 以下代碼僅保留了該月份的總銷售額超過400的數據桶: ``` POST /sales/_search { "size": 0, "aggs" : { "sales_per_month" : { "date_histogram" : { "field" : "date", "interval" : "month" }, "aggs": { "total_sales": { "sum": { "field": "price" } }, "sales_bucket_filter": { "bucket_selector": { "buckets_path": { "totalSales": "total_sales" }, "script": "params.totalSales > 200" } } } } } } ``` 以下是響應信息: ``` { "took": 11, "timed_out": false, "_shards": ..., "hits": ..., "aggregations": { "sales_per_month": { "buckets": [ { "key_as_string": "2015/01/01 00:00:00", "key": 1420070400000, "doc_count": 3, "total_sales": { "value": 550.0 } }, #1 { "key_as_string": "2015/03/01 00:00:00", "key": 1425168000000, "doc_count": 2, "total_sales": { "value": 375.0 }, } ] } } } ``` | 1 | 由于其總銷售額不足200,所以2015/02/01 00:00:00 的bucket已被移除 | 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html)(修改該鏈接為官網對應的鏈接) 譯文鏈接 : [http://www.apache.wiki/pages/viewpage.action?pageId=10030397](http://www.apache.wiki/pages/viewpage.action?pageId=10030397)(修改該鏈接為 **ApacheCN** 對應的譯文鏈接) 貢獻者 : [曾少峰](/display/~zengshaofeng),[ApacheCN](/display/~apachecn),[Apache中文網](/display/~apachechina)
                  <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>

                              哎呀哎呀视频在线观看