Class: Elasticated::GeohashGridAggregation
- Inherits:
-
Aggregation
- Object
- Aggregation
- Elasticated::GeohashGridAggregation
- Defined in:
- lib/elasticated/aggregations/geohash_grid_aggregation.rb
Instance Attribute Summary
Attributes inherited from Aggregation
#alias_name, #extra_params, #field
Instance Method Summary collapse
-
#build ⇒ Object
TODO: this is exactly the same as in SingleValueAggregation.
- #default_name ⇒ Object
- #parse(response) ⇒ Object
Methods inherited from Aggregation
#initialize, #name, #original_name
Methods included from Mixins::Inspectionable
Methods included from Mixins::BlockEvaluation
Methods included from Mixins::Clonable
Constructor Details
This class inherits a constructor from Elasticated::Aggregation
Instance Method Details
#build ⇒ Object
TODO: this is exactly the same as in SingleValueAggregation
9 10 11 12 13 |
# File 'lib/elasticated/aggregations/geohash_grid_aggregation.rb', line 9 def build operation_info = { field: field } operation_info.merge! extra_params { operation => operation_info } end |
#default_name ⇒ Object
4 5 6 |
# File 'lib/elasticated/aggregations/geohash_grid_aggregation.rb', line 4 def default_name "geohash_grid_by_#{field}" end |
#parse(response) ⇒ Object
15 16 17 18 19 |
# File 'lib/elasticated/aggregations/geohash_grid_aggregation.rb', line 15 def parse(response) response['buckets'].each_with_object({}) do |bucket, hash| hash[bucket['key']] = bucket['doc_count'] end end |