Class: Aggregations::Buckets::HistogramAggregationBuilder
- Inherits:
-
Object
- Object
- Aggregations::Buckets::HistogramAggregationBuilder
- Includes:
- Helpers::AbstractAggregationHelper, Helpers::AggregationQueryBuilderHelper, Helpers::ValuesSourceAggregationHelper, AttributesReader
- Defined in:
- lib/aggregations/buckets/histogram_aggregation_builder.rb
Overview
Elasticsearch Histogram Aggregation
Constant Summary collapse
- ATTRIBUTES =
[:order, :interval, :min_doc_count]
Constants included from Helpers::AggregationQueryBuilderHelper
Helpers::AggregationQueryBuilderHelper::OBJECT_ARRAY_QUERY_FIELDS, Helpers::AggregationQueryBuilderHelper::OBJECT_ARRAY_SETTINGS_FIELDS
Instance Method Summary collapse
-
#add_order(bucket_order) ⇒ HistogramAggregationBuilder
, can be chained for ordering on multiple fields.
-
#initialize(name:) ⇒ HistogramAggregationBuilder
constructor
A new instance of HistogramAggregationBuilder.
- #interval(interval) ⇒ HistogramAggregationBuilder
- #interval_expr ⇒ String
- #min_doc_count(doc_count) ⇒ HistogramAggregationBuilder
- #min_doc_count_expr ⇒ Integer
- #order_expr ⇒ Array
Methods included from AttributesReader
Methods included from Helpers::AggregationQueryBuilderHelper
#name_expr, #query, #type_expr
Methods included from Helpers::AbstractAggregationHelper
#abstract_agg_builder, #sub_aggregation, #sub_aggregation_expr
Methods included from Helpers::ValuesSourceAggregationHelper
#field, #field_expr, #missing, #missing_expr, #script, #script_expr, #value_source_agg_builder
Constructor Details
#initialize(name:) ⇒ HistogramAggregationBuilder
Returns a new instance of HistogramAggregationBuilder.
14 15 16 17 18 19 20 21 22 |
# File 'lib/aggregations/buckets/histogram_aggregation_builder.rb', line 14 def initialize name: @name = name.intern @type = :histogram @query = { @name => { @type => {} } } end |
Instance Method Details
#add_order(bucket_order) ⇒ HistogramAggregationBuilder
Returns , can be chained for ordering on multiple fields.
26 27 28 29 30 |
# File 'lib/aggregations/buckets/histogram_aggregation_builder.rb', line 26 def add_order bucket_order @order ||= [] @order << bucket_order.settings self end |
#interval(interval) ⇒ HistogramAggregationBuilder
39 40 41 42 |
# File 'lib/aggregations/buckets/histogram_aggregation_builder.rb', line 39 def interval interval @interval = interval self end |
#interval_expr ⇒ String
45 46 47 |
# File 'lib/aggregations/buckets/histogram_aggregation_builder.rb', line 45 def interval_expr @interval end |
#min_doc_count(doc_count) ⇒ HistogramAggregationBuilder
51 52 53 54 |
# File 'lib/aggregations/buckets/histogram_aggregation_builder.rb', line 51 def min_doc_count doc_count @min_doc_count = doc_count self end |
#min_doc_count_expr ⇒ Integer
57 58 59 |
# File 'lib/aggregations/buckets/histogram_aggregation_builder.rb', line 57 def min_doc_count_expr @min_doc_count end |
#order_expr ⇒ Array
33 34 35 |
# File 'lib/aggregations/buckets/histogram_aggregation_builder.rb', line 33 def order_expr @order end |