Class: JayAPI::Elasticsearch::QueryBuilder::Aggregations::BucketSelector
- Inherits:
-
Aggregation
- Object
- Aggregation
- JayAPI::Elasticsearch::QueryBuilder::Aggregations::BucketSelector
- Defined in:
- lib/jay_api/elasticsearch/query_builder/aggregations/bucket_selector.rb
Overview
Represents a bucket_selector pipeline aggregation in Elasticsearch. Docs: www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-selector-aggregation.html
Instance Attribute Summary collapse
-
#buckets_path ⇒ Object
readonly
Returns the value of attribute buckets_path.
-
#gap_policy ⇒ Object
readonly
Returns the value of attribute gap_policy.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
Attributes inherited from Aggregation
Instance Method Summary collapse
-
#aggs ⇒ Object
Bucket selector is a pipeline agg and cannot have nested aggregations.
-
#clone ⇒ self
A copy of the receiver.
-
#initialize(name, buckets_path:, script:, gap_policy: nil) ⇒ BucketSelector
constructor
A new instance of BucketSelector.
-
#to_h ⇒ Hash
The Hash representation of the
Aggregation.
Constructor Details
#initialize(name, buckets_path:, script:, gap_policy: nil) ⇒ BucketSelector
Returns a new instance of BucketSelector.
26 27 28 29 30 31 32 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/bucket_selector.rb', line 26 def initialize(name, buckets_path:, script:, gap_policy: nil) super(name) @buckets_path = buckets_path @script = script @gap_policy = gap_policy end |
Instance Attribute Details
#buckets_path ⇒ Object (readonly)
Returns the value of attribute buckets_path.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/bucket_selector.rb', line 13 def buckets_path @buckets_path end |
#gap_policy ⇒ Object (readonly)
Returns the value of attribute gap_policy.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/bucket_selector.rb', line 13 def gap_policy @gap_policy end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
13 14 15 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/bucket_selector.rb', line 13 def script @script end |
Instance Method Details
#aggs ⇒ Object
Bucket selector is a pipeline agg and cannot have nested aggregations.
36 37 38 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/bucket_selector.rb', line 36 def aggs no_nested_aggregations('Bucket Selector') end |
#clone ⇒ self
Returns A copy of the receiver.
41 42 43 44 45 46 47 48 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/bucket_selector.rb', line 41 def clone self.class.new( name, buckets_path: buckets_path.is_a?(Hash) ? buckets_path.dup : buckets_path, script:, # Script is immutable-ish, ok to reuse gap_policy: ) end |
#to_h ⇒ Hash
Returns The Hash representation of the Aggregation. Properly formatted for Elasticsearch.
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/jay_api/elasticsearch/query_builder/aggregations/bucket_selector.rb', line 52 def to_h super do { bucket_selector: { buckets_path: buckets_path, script: script.to_h, gap_policy: gap_policy }.compact } end end |