Class: Elastic::Nodes::TopHits

Inherits:
BaseAgg show all
Includes:
Concerns::HitProvider
Defined in:
lib/elastic/nodes/agg/top_hits.rb

Instance Attribute Summary

Attributes included from Concerns::HitProvider

#size, #source

Attributes inherited from BaseAgg

#name

Instance Method Summary collapse

Methods included from Concerns::HitProvider

#clone, #simplify

Methods inherited from BaseAgg

build, #clone, #initialize, #simplify

Methods inherited from Base

#==, #clone, #simplify, #traverse

Methods included from Support::Traversable

#pick_nodes, #traverse

Constructor Details

This class inherits a constructor from Elastic::Nodes::BaseAgg

Instance Method Details

#handle_result(_raw, _formatter) ⇒ Object



12
13
14
15
# File 'lib/elastic/nodes/agg/top_hits.rb', line 12

def handle_result(_raw, _formatter)
  hits = _raw['hits'] ? prepare_hits(_raw['hits']['hits'], _formatter) : []
  Elastic::Results::HitCollection.new(hits)
end

#render(_options = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/elastic/nodes/agg/top_hits.rb', line 5

def render(_options = {})
  hash = {}
  render_hit_options hash

  { 'top_hits' => hash }
end