Class: Arelastic::Searches::Aggregations

Inherits:
Search show all
Defined in:
lib/arelastic/searches/aggregations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Nodes::Node

#==, #convert_to_elastic, #read_option!

Methods included from Arities::Binary

#binary

Methods included from Arities::Polyadic

#polyadic

Methods included from Arities::Unary

#unary

Constructor Details

#initialize(*aggs) ⇒ Aggregations

Returns a new instance of Aggregations.



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

def initialize *aggs
  @aggs = aggs.flatten
end

Instance Attribute Details

#aggsObject

Returns the value of attribute aggs.



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

def aggs
  @aggs
end

Instance Method Details

#as_elasticObject



10
11
12
13
# File 'lib/arelastic/searches/aggregations.rb', line 10

def as_elastic
  grouping = Arelastic::Nodes::HashGroup.new(aggs)
  { "aggs" => grouping.as_elastic }
end