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, #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
10
11
12
# File 'lib/arelastic/aggregations/bucket_sort.rb', line 6

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

Instance Attribute Details

#fromObject

Returns the value of attribute from.



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

def from
  @from
end

#sizeObject

Returns the value of attribute size.



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

def size
  @size
end

#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



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

def as_elastic_aggregation
  bucket_sort = {}
  bucket_sort['sort'] = parse_sort if sort
  bucket_sort['from'] = from if from
  bucket_sort['size'] = size if size
  { 'bucket_sort' => bucket_sort }
end