Class: Aggregations::Buckets::TopHitsAggregationBuilder
Overview
Elasticsearch Top Hits Aggregation
Constant Summary
collapse
- ATTRIBUTES =
[:size, :sort, :_source]
Helpers::AggregationQueryBuilderHelper::OBJECT_ARRAY_QUERY_FIELDS, Helpers::AggregationQueryBuilderHelper::OBJECT_ARRAY_SETTINGS_FIELDS
Instance Method Summary
collapse
#attributes
#name_expr, #query, #type_expr
#abstract_agg_builder, #sub_aggregation, #sub_aggregation_expr
Constructor Details
Returns a new instance of TopHitsAggregationBuilder.
13
14
15
16
17
18
19
20
21
|
# File 'lib/aggregations/buckets/top_hits_aggregation_builder.rb', line 13
def initialize name:
@name = name.intern
@type = :top_hits
@query = {
@name => {
@type => {}
}
}
end
|
Instance Method Details
37
38
39
40
41
|
# File 'lib/aggregations/buckets/top_hits_aggregation_builder.rb', line 37
def add_sort sort
@sort ||= []
@sort << sort
self
end
|
25
26
27
28
|
# File 'lib/aggregations/buckets/top_hits_aggregation_builder.rb', line 25
def size size
@size = size
self
end
|
#size_expr ⇒ Integer
31
32
33
|
# File 'lib/aggregations/buckets/top_hits_aggregation_builder.rb', line 31
def size_expr
@size
end
|
44
45
46
|
# File 'lib/aggregations/buckets/top_hits_aggregation_builder.rb', line 44
def sort_expr
@sort
end
|
58
59
60
61
62
|
# File 'lib/aggregations/buckets/top_hits_aggregation_builder.rb', line 58
def source_exclude exclude_list
@_source ||= {}
@_source[:exclude] = exclude_list if exclude_list.present?
self
end
|
#source_exclude_expr ⇒ Array
71
72
73
74
|
# File 'lib/aggregations/buckets/top_hits_aggregation_builder.rb', line 71
def source_exclude_expr
return [] unless @_source.present?
@_source[:exclude]
end
|
50
51
52
53
54
|
# File 'lib/aggregations/buckets/top_hits_aggregation_builder.rb', line 50
def source_include include_list
@_source ||= {}
@_source[:include] = include_list if include_list.present?
self
end
|
#source_include_expr ⇒ Array
65
66
67
68
|
# File 'lib/aggregations/buckets/top_hits_aggregation_builder.rb', line 65
def source_include_expr
return [] unless @_source.present?
@_source[:include]
end
|