Class: Arelastic::Aggregations::BucketSort

Inherits:
Aggregation show all
Defined in:
lib/arelastic/aggregations/bucket_sort.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, #hash, #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 = {}) ⇒ BucketSort

Returns a new instance of BucketSort.



6
7
8
9
# File 'lib/arelastic/aggregations/bucket_sort.rb', line 6

def initialize(name, options = {})
  super
  @sort = read_option! options, 'sort'
end

Instance Attribute Details

#sortObject

Returns the value of attribute sort.



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

def sort
  @sort
end

Instance Method Details

#as_elastic_aggregationObject



11
12
13
14
15
# File 'lib/arelastic/aggregations/bucket_sort.rb', line 11

def as_elastic_aggregation
  params = options
  params = params.merge('sort' => convert_to_elastic(sort)) if sort
  { 'bucket_sort' => params }
end