Class: JayAPI::Elasticsearch::QueryBuilder::Aggregations::TopHits
- Inherits:
-
Aggregation
- Object
- Aggregation
- JayAPI::Elasticsearch::QueryBuilder::Aggregations::TopHits
- Defined in:
- lib/jay_api/elasticsearch/query_builder/aggregations/top_hits.rb
Overview
Represents a filter
aggregation in Elasticsearch. Information on this type of aggregation can be found here: www.elastic.co/docs/reference/aggregations/search-aggregations-metrics-top-hits-aggregation
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from Aggregation
Instance Method Summary collapse
-
#clone ⇒ self
A copy of the receiver.
-
#initialize(name, size:) ⇒ TopHits
constructor
A new instance of TopHits.
-
#to_h ⇒ Hash
The Hash representation of the
Aggregation
.
Methods inherited from Aggregation
Constructor Details
#initialize(name, size:) ⇒ TopHits
Returns a new instance of TopHits.
23 24 25 26 27 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/top_hits.rb', line 23 def initialize(name, size:) super(name) @size = size end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
18 19 20 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/top_hits.rb', line 18 def size @size end |
Instance Method Details
#clone ⇒ self
Returns A copy of the receiver.
30 31 32 33 34 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/top_hits.rb', line 30 def clone copy = self.class.new(name, size: size) copy.aggregations = aggregations.clone copy end |
#to_h ⇒ Hash
Returns The Hash representation of the Aggregation
. Properly formatted for Elasticsearch.
38 39 40 41 42 43 44 45 46 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/top_hits.rb', line 38 def to_h super do { top_hits: { size: size } } end end |