Class: JayAPI::Elasticsearch::QueryBuilder::Aggregations::Cardinality
- Inherits:
-
Aggregation
- Object
- Aggregation
- JayAPI::Elasticsearch::QueryBuilder::Aggregations::Cardinality
- Defined in:
- lib/jay_api/elasticsearch/query_builder/aggregations/cardinality.rb
Overview
Represents a cardinality
aggregation in Elasticsearch. Information on this type of aggregation can be found here: www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
Attributes inherited from Aggregation
Instance Method Summary collapse
- #aggs ⇒ Object
-
#clone ⇒ self
A copy of the receiver.
-
#initialize(name, field:) ⇒ Cardinality
constructor
A new instance of Cardinality.
-
#to_h ⇒ Hash
The Hash representation of the
Aggregation
.
Constructor Details
#initialize(name, field:) ⇒ Cardinality
Returns a new instance of Cardinality.
19 20 21 22 23 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/cardinality.rb', line 19 def initialize(name, field:) super(name) @field = field end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/cardinality.rb', line 13 def field @field end |
Instance Method Details
#aggs ⇒ Object
28 29 30 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/cardinality.rb', line 28 def aggs no_nested_aggregations('Cardinality') end |
#clone ⇒ self
Returns A copy of the receiver.
33 34 35 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/cardinality.rb', line 33 def clone self.class.new(name, field: field) end |
#to_h ⇒ Hash
Returns The Hash representation of the Aggregation
. Properly formatted for Elasticsearch.
39 40 41 42 43 44 45 46 47 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/cardinality.rb', line 39 def to_h super do { cardinality: { field: field } } end end |