code: def check_at_most_requests(self, source, dest, num_requests, **kwargs):
          
          # TODO: Does the proxy support logging of instances so that grouping by instance is possible?
  
          if self.debug:
              print 'in check_at_most_requests (%s, %s, %s, %s)' % (source, dest, num_requests, self._id)
  
          # Fetch requests for src->dst
          data = self._es.search(body={
              "size": max_query_results,
              "query": {
                  "filtered": {
                      "query": {
                          "match_all": {}
                      },
                      "filter": {
                          "bool": {
                              "must": [
                                  {"term": {"msg": "Request"}},
                                  {"term": {"source": source}},
                                  {"term": {"dest": dest}},
                                  {"term": {"protocol": "http"}},
                                  {"term": {"testid": self._id}}
                              ]
                          }
                      }
                  }
              },
              "aggs": {
                  # Need size, otherwise only top buckets are returned
                  #"size": max_query_results,
                  "byid": {
                      "terms": {
                          "field": "reqID",
                      }
                  }
              }
          })
  
          if self.debug:
              pprint.pprint(data)
  
          result = True
          errormsg = ""
          if not self._check_non_zero_results(data):
              result = False
              errormsg = "No log entries found"
              return GremlinTestResult(result, errormsg)
  
          # Check number of requests in each bucket
          for bucket in data["aggregations"]["byid"]["buckets"]:
              if bucket["doc_count"] > (num_requests + 1):
                  errormsg = "{} -> {} - expected {} requests, but found {} "\
                           "requests for id {}".format(
                              source, dest, num_requests, bucket['doc_count'] - 1,
                              bucket['key'])
                  result = False
                  if self.debug:
                      print errormsg
                  return GremlinTestResult(result, errormsg)
          return GremlinTestResult(result, errormsg)
docs: Check that source service sent at most num_request to the dest service
          :param source the source service name
          :param dest the destination service name
          :param num_requests the maximum number of requests that we expect
          :return: