code: def get_aggs(self):
          
  
          res = self.fetch_aggregation_results()
          if 'aggregations' in res and 'values' in res['aggregations'][str(self.parent_agg_counter - 1)]:
              try:
                  agg = res['aggregations'][str(self.parent_agg_counter - 1)]['values']["50.0"]
                  if agg == 'NaN':
                      # ES returns NaN. Convert to None for matplotlib graph
                      agg = None
              except Exception as e:
                  raise RuntimeError("Multivalue aggregation result not supported")
  
          elif 'aggregations' in res and 'value' in res['aggregations'][str(self.parent_agg_counter - 1)]:
              agg = res['aggregations'][str(self.parent_agg_counter - 1)]['value']
  
          else:
              agg = res['hits']['total']
  
          return agg
docs: Compute the values for single valued aggregations
  
          :returns: the single aggregation value