Class: Aggregations::Buckets::DateHistogramAggregationBuilder
- Inherits:
-
Object
- Object
- Aggregations::Buckets::DateHistogramAggregationBuilder
- Includes:
- Helpers::AbstractAggregationHelper, Helpers::AggregationQueryBuilderHelper, Helpers::ValuesSourceAggregationHelper, AttributesReader
- Defined in:
- lib/aggregations/buckets/date_histogram_aggregation_builder.rb
Overview
Elasticsearch Date Histogram Aggregation
Constant Summary collapse
- ATTRIBUTES =
[:order, :calendar_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) ⇒ DateHistogramAggregationBuilder
, can be chained for ordering on multiple fields.
- #calendar_interval(interval) ⇒ DateHistogramAggregationBuilder
- #calendar_interval_expr ⇒ String
-
#initialize(name:) ⇒ DateHistogramAggregationBuilder
constructor
A new instance of DateHistogramAggregationBuilder.
- #min_doc_count(doc_count) ⇒ DateHistogramAggregationBuilder
- #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:) ⇒ DateHistogramAggregationBuilder
Returns a new instance of DateHistogramAggregationBuilder.
14 15 16 17 18 19 20 21 22 |
# File 'lib/aggregations/buckets/date_histogram_aggregation_builder.rb', line 14 def initialize name: @name = name.intern @type = :date_histogram @query = { @name => { @type => {} } } end |
Instance Method Details
#add_order(bucket_order) ⇒ DateHistogramAggregationBuilder
Returns , can be chained for ordering on multiple fields.
26 27 28 29 30 |
# File 'lib/aggregations/buckets/date_histogram_aggregation_builder.rb', line 26 def add_order bucket_order @order ||= [] @order << bucket_order.settings self end |
#calendar_interval(interval) ⇒ DateHistogramAggregationBuilder
39 40 41 42 |
# File 'lib/aggregations/buckets/date_histogram_aggregation_builder.rb', line 39 def calendar_interval interval @calendar_interval = interval self end |
#calendar_interval_expr ⇒ String
45 46 47 |
# File 'lib/aggregations/buckets/date_histogram_aggregation_builder.rb', line 45 def calendar_interval_expr @calendar_interval end |
#min_doc_count(doc_count) ⇒ DateHistogramAggregationBuilder
51 52 53 54 |
# File 'lib/aggregations/buckets/date_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/date_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/date_histogram_aggregation_builder.rb', line 33 def order_expr @order end |