code: def count(self):
          
          if hasattr(self, '_response'):
              return self._response.hits.total
  
          es = connections.get_connection(self._using)
  
          d = self.to_dict(count=True)
          # TODO: failed shards detection
          return es.count(
              index=self._index,
              body=d,
              **self._params
          )['count']
docs: Return the number of hits matching the query and filters. Note that
          only the actual number is returned.