Class: Arelastic::Aggregations::BucketSelector

Inherits:
Aggregation show all
Defined in:
lib/arelastic/aggregations/bucket_selector.rb

Instance Attribute Summary collapse

Attributes inherited from Aggregation

#meta, #name, #options

Instance Method Summary collapse

Methods inherited from Aggregation

#as_elastic, #nested, #reverse_nested

Methods inherited from Nodes::Node

#==, #convert_to_elastic, #read_option!

Methods included from Arelastic::Arities::Binary

#binary

Methods included from Arelastic::Arities::Polyadic

#polyadic

Methods included from Arelastic::Arities::Unary

#unary

Constructor Details

#initialize(name, options = {}) ⇒ BucketSelector

Returns a new instance of BucketSelector.



6
7
8
9
10
11
# File 'lib/arelastic/aggregations/bucket_selector.rb', line 6

def initialize(name, options = {})
  options = options.dup
  @script_params = read_option! options, 'script_params'
  @script = read_option! options, 'script'
  super(name, options)
end

Instance Attribute Details

#scriptObject

Returns the value of attribute script.



4
5
6
# File 'lib/arelastic/aggregations/bucket_selector.rb', line 4

def script
  @script
end

#script_paramsObject

Returns the value of attribute script_params.



4
5
6
# File 'lib/arelastic/aggregations/bucket_selector.rb', line 4

def script_params
  @script_params
end

Instance Method Details

#as_elastic_aggregationObject



13
14
15
16
17
18
19
20
# File 'lib/arelastic/aggregations/bucket_selector.rb', line 13

def as_elastic_aggregation
  {
    'bucket_selector' => {
      'buckets_path' => script_params,
      'script' => script
    }
  }
end