Class: Elasticsearch::DSL::Search::Aggregations::BucketScript

Inherits:
Object
  • Object
show all
Includes:
BaseAggregationComponent
Defined in:
lib/elasticsearch/dsl/search/aggregations/pipeline/bucket_script.rb

Overview

A parent pipeline aggregation which executes a script which can perform per bucket computations on specified metrics in the parent multi-bucket aggregation.

Examples:

Passing the options as a Hash


aggregation :t-shirt-percentage do
  bucket_script buckets_path: { tShirtSales: 't-shirts>sales', totalSales: 'total_sales' }, script: 'tShirtSales / totalSales * 100'
end

Passing the options as a block


aggregation :t-shirt-percentage do
  bucket_script do
    buckets_path tShirtSales: 't-shirts>sales', totalSales: 'total_sales'
    script 'tShirtSales / totalSales * 100'
  end
end

See Also:

Method Summary

Methods included from BaseAggregationComponent

included