docs: def get_timeseries(self, child_agg_count=0, dataframe=False):
          """
          Get time series data for the specified fields and period of analysis
  
          :param child_agg_count: the child aggregation count to be used
                                  default = 0
          :param dataframe: if dataframe=True, return a pandas.DataFrame object
          :returns: dictionary containing "date", "value" and "unixtime" keys
                    with lists as values containing data from each bucket in the
                    aggregation
          """
  
          res = self.fetch_aggregation_results()
  
          ts = {"date": [], "value": [], "unixtime": []}
  
          if 'buckets' not in res['aggregations'][str(self.parent_agg_counter - 1)]:
              raise RuntimeError("Aggregation results have no buckets in time series results.")
  
          for bucket in res['aggregations'][str(self.parent_agg_counter - 1)]['buckets']:
              ts['date'].append(parser.parse(bucket['key_as_string']).date())
              if str(child_agg_count) in bucket:
                  # We have a subaggregation with the value
                  # If it is percentiles we get the median
                  if 'values' in bucket[str(child_agg_count)]:
                      val = bucket[str(child_agg_count)]['values']['50.0']
                      if val == 'NaN':
                          # ES returns NaN. Convert to None for matplotlib graph
                          val = None
                      ts['value'].append(val)
                  else:
                      ts['value'].append(bucket[str(child_agg_count)]['value'])
              else:
                  ts['value'].append(bucket['doc_count'])
              # unixtime comes in ms from ElasticSearch
              ts['unixtime'].append(bucket['key'] / 1000)
  
          if dataframe:
              df = pd.DataFrame.from_records(ts, index="date")
              return df.fillna(0)
          return ts