matthuhiggins/arelastic

View on GitHub
lib/arelastic/aggregations/special_single_bucket.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Arelastic
  module Aggregations
    class SpecialSingleBucket < Arelastic::Aggregations::Bucket
      attr_accessor :specification

      def initialize(name, specification, aggs)
        super name, aggs: aggs
        @specification = specification
      end

      def as_elastic_aggregation
        { aggregation_name => { specification_key => specification } }.merge(super)
      end
    end
  end
end