code: def get_aggregation(self, name):
          '''
          Fetch an aggregation result given its name
  
          As there is no way at this point know the aggregation type
          (ie. bucket, pipeline or metric)
          we guess it from the response attributes.
          Only bucket and metric types are handled
          '''
          agg = self.aggregations[name]
          if 'buckets' in agg:
              return agg['buckets']
          else:
              return agf get_aggregation(self, name):
          '''
          Fetch an aggregation result given its name
  
          As there is no way at this point know the aggregation type
          (ie. bucket, pipeline or metric)
          we guess it from the response attributes.
          Only bucket and metric types are handled
          '''
          agg = self.aggregations[name]
          if 'buckets' in agg:
              return agg['buckets']
          else:
              return agg
docs: Fetch an aggregation result given its name
  
          As there is no way at this point know the aggregation type
          (ie. bucket, pipeline or metric)
          we guess it from the response attributes.
          Only bucket and metric types are handled