<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 Script Aggregation(桶腳本聚合) 父級管道聚合,它執行一個腳本,它可以在父級多桶聚合中指定度量參數執行每個桶計算。指定的度量必須是數字,腳本必須返回一個數值。 ## Syntax(語法) bucket_script聚合看起來像這樣: | `{` `"bucket_script"``: {` `"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?11.?`bucket_script`?Parameters(Table 11.bucket_script參數) | 參數名稱 | 描述 | 是否必要 | 默認值 | | --- | --- | --- | --- | | `script` | 在這個聚合上運行的腳本。這個腳本可以是內置的,文件或索引。(詳細信息,請查閱Scripting) | 必須 | ? | | `buckets_path` | 腳本變量的映射,以及我們希望用于桶的變量的相關路徑(相關詳細信息,請參閱“buckets_path Syntax”一節) | 必須 | ? | | `gap_policy` | 在數據中找到差異時應用的策略(相關詳情,請參閱“Dealing with gaps in the data”一節) | 可選 | `skip` | | `format` | 應用于此聚合的輸出值的格式 | 可選 | `null` | 以下代碼計算了T恤銷售額與每月銷售額的比例: | `POST /sales/_search` `{` `"size"``:?``0``,` `"aggs"`?`: {` `"sales_per_month"`?`: {` `"date_histogram"`?`: {` `"field"`?`:?``"date"``,` `"interval"`?`:?``"month"` `},` `"aggs"``: {` `"total_sales"``: {` `"sum"``: {` `"field"``:?``"price"` `}` `},` `"t-shirts"``: {` `"filter"``: {` `"term"``: {` `"type"``:?``"t-shirt"` `}` `},` `"aggs"``: {` `"sales"``: {` `"sum"``: {` `"field"``:?``"price"` `}` `}` `}` `},` `"t-shirt-percentage"``: {` `"bucket_script"``: {` `"buckets_path"``: {` `"tShirtSales"``:?``"t-shirts>sales"``,` `"totalSales"``:?``"total_sales"` `},` `"script"``:?``"params.tShirtSales / params.totalSales * 100"` `}` `}` `}` `}` `}` `}` | 以下是響應信息: | `{` `"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` `},` `"t-shirts"``: {` `"doc_count"``:?``1``,` `"sales"``: {` `"value"``:?``200.0` `}` `},` `"t-shirt-percentage"``: {` `"value"``:?``36.36363636363637` `}` `},` `{` `"key_as_string"``:?``"2015/02/01 00:00:00"``,` `"key"``:?``1422748800000``,` `"doc_count"``:?``2``,` `"total_sales"``: {` `"value"``:?``60.0` `},` `"t-shirts"``: {` `"doc_count"``:?``1``,` `"sales"``: {` `"value"``:?``10.0` `}` `},` `"t-shirt-percentage"``: {` `"value"``:?``16.666666666666664` `}` `},` `{` `"key_as_string"``:?``"2015/03/01 00:00:00"``,` `"key"``:?``1425168000000``,` `"doc_count"``:?``2``,` `"total_sales"``: {` `"value"``:?``375.0` `},` `"t-shirts"``: {` `"doc_count"``:?``1``,` `"sales"``: {` `"value"``:?``175.0` `}` `},` `"t-shirt-percentage"``: {` `"value"``:?``46.666666666666664` `}` `}` `]` `}` `}` `}` |
                  <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>

                              哎呀哎呀视频在线观看