007 PipeLine Agg

# PipeLine Agg

# 第一类,sibling  结果和现有的分析结果同级

# max,min, avg & sum bucket;stats bucket; percentiles bucket

# 第二类,parent,结果内嵌到现有的聚合分析之中

# derivative 求导; Cumultive Sum累计求和;Moving Function滑动窗口

POST kibana_sample_data_flights/_search

{

  "size": 0,

  "aggs": {

    "Dests": {

      "terms": {

        "field": "Dest",

        "size": 10

      },

      "aggs": {

        "avg_AvgTicketPrice": {

          "avg": {

            "field": "AvgTicketPrice"

          }

        }

      }

    },

    "stats_by_dest": {

    "stats_bucket": {

      "buckets_path": "Dests.avg_AvgTicketPrice"

    }

    }

  }

}

POST  kibana_sample_data_flights/_search

{

  "size": 0,

  "aggs": {

    "DistanceMiles": {

      "histogram": {

        "field": "DistanceMiles",

        "interval": 200,

        "min_doc_count": 100

      },

      "aggs": {

        "avg_AvgTicketPrice": {

          "avg": {

            "field": "AvgTicketPrice"

          }

        },

        "derivative_avg_AvgTicketPrice":{

          "derivative": {

            "buckets_path": "avg_AvgTicketPrice"

          }

        }

      }

    }

  }

}

你可能感兴趣的:(007 PipeLine Agg)